Class SparseListUtils

java.lang.Object
ubic.gemma.model.util.SparseListUtils

public class SparseListUtils extends Object
Utilities for dealing with sparse List
Author:
poirigui
  • Constructor Details

    • SparseListUtils

      public SparseListUtils()
  • Method Details

    • getSparseArrayElement

      public static <T> T getSparseArrayElement(List<T> array, int[] indices, int numberOfElements, int index, T defaultValue)
      Get an element of a sparse array.
    • validateSparseArray

      public static <T> void validateSparseArray(List<T> array, int[] indices, int numberOfElements, @Nullable T defaultValue)
    • getSparseRangeArrayElement

      public static <T> T getSparseRangeArrayElement(List<T> array, int[] offsets, int numberOfElements, int index) throws IllegalArgumentException, IndexOutOfBoundsException
      Get an element of a sparse range array.
      Parameters:
      array - collection of elements applying for the ranges
      offsets - starting offsets of the ranges
      numberOfElements - the size of the original array
      index - a position to retrieve
      Throws:
      IndexOutOfBoundsException - if the requested index is out of bounds
      IllegalArgumentException - if the array is empty or its size differs from offsets
      See Also:
    • validateSparseRangeArray

      public static void validateSparseRangeArray(List<?> array, int[] offsets, int numberOfElements) throws IllegalArgumentException
      Validate a sparse range array.
      Parameters:
      array - collection of elements applying for the ranges
      offsets - starting offsets of the ranges
      numberOfElements - the size of the original array
      Throws:
      IllegalArgumentException - if the sparse range array is invalid