Package org.codehaus.jackson.map.util
Class ArrayBuilders
java.lang.Object
org.codehaus.jackson.map.util.ArrayBuilders
Helper class that contains set of distinct builders for different
arrays of primitive values. It also provides trivially simple
reuse scheme, which assumes that caller knows not to use instances
concurrently (which works ok with primitive arrays since they can
not contain other non-primitive types).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
static final class
static final class
static final class
static final class
static final class
static final class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List
<T> Helper method for adding specified element to a List, but also considering case where the List may not have been yet constructed (that is, null is passed instead).static <T> Iterable
<T> arrayAsIterable
(T[] array) static <T> Iterator
<T> arrayAsIterator
(T[] array) Helper method for exposing contents of arrays using a read-only iteratorstatic <T> HashSet
<T> arrayToSet
(T[] elements) static <T> T[]
insertInList
(T[] array, T element) Helper method for constructing a new array that contains specified element followed by contents of the given array.static <T> T[]
insertInListNoDup
(T[] array, T element) Helper method for constructing a new array that contains specified element followed by contents of the given array but never contains duplicates.
-
Constructor Details
-
ArrayBuilders
public ArrayBuilders()
-
-
Method Details
-
getBooleanBuilder
-
getByteBuilder
-
getShortBuilder
-
getIntBuilder
-
getLongBuilder
-
getFloatBuilder
-
getDoubleBuilder
-
arrayToSet
-
addToList
Helper method for adding specified element to a List, but also considering case where the List may not have been yet constructed (that is, null is passed instead).- Parameters:
list
- List to add to; may be null to indicate that a new List is to be constructedelement
- Element to add to list- Returns:
- List in which element was added; either
list
(if it was not null), or a newly constructed List.
-
insertInList
public static <T> T[] insertInList(T[] array, T element) Helper method for constructing a new array that contains specified element followed by contents of the given array. No checking is done to see if element being inserted is duplicate. -
insertInListNoDup
public static <T> T[] insertInListNoDup(T[] array, T element) Helper method for constructing a new array that contains specified element followed by contents of the given array but never contains duplicates. If element already existed, one of two things happens: if the element was already the first one in array, array is returned as is; but if not, a new copy is created in which element has moved as the head. -
arrayAsIterator
Helper method for exposing contents of arrays using a read-only iterator- Since:
- 1.7
-
arrayAsIterable
-