Package net.hydromatic.morel.util
Class Static
java.lang.Object
net.hydromatic.morel.util.Static
Utilities.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> List<E> Returns a list with one element appended.private static booleangetBooleanProperty(String prop, boolean defaultVal) Returns the value of a system property, converted into a boolean value.static <E> List<E> static <E> List<E> Removes all occurrences of an element from a list.static intnextPowerOfTwo(int n) Next power of two.static <E> List<E> Prepends an element to a list.static <K,V> Map <K, V> Adds an element to a map.static <K extends Comparable<K>,V>
SortedMap<K, V> Adds an element to a sorted map.static <E> booleanshorterThan(Iterable<E> iterable, int n) Returns whether anIterablehas fewer thannelements.static <E> List<E> Returns all but the firstcountelements of a list.static <E> List<E> Returns all but the first element of a list.static Stringstr(StringBuilder b) Flushes a builder and returns its contents.static <T> Collector<T, com.google.common.collect.ImmutableList.Builder<T>, com.google.common.collect.ImmutableList<T>> Returns aCollectorthat accumulates the input elements into a GuavaImmutableListvia aImmutableList.Builder.static <E,T> Iterable <T> Lazily transforms an Iterable, applying a mapping function to each element.static <E,T> List <T> Lazily transforms a list, applying a mapping function to each element.static <E,T> com.google.common.collect.ImmutableList <T> transformEager(Iterable<? extends E> elements, Function<E, T> mapper) Eagerly converts an Iterable to an ImmutableList, applying a mapping function to each element.static <E,T> com.google.common.collect.ImmutableList <T> transformEager(List<? extends E> elements, Function<E, T> mapper) Eagerly converts a List to an ImmutableList, applying a mapping function to each element.
-
Field Details
-
SKIP
public static final boolean SKIPWhether to skip built-in functions.To skip built-in functions, add "-DskipMorelBuiltIns" java's command-line arguments.
-
-
Constructor Details
-
Static
private Static()
-
-
Method Details
-
getBooleanProperty
Returns the value of a system property, converted into a boolean value.Values "", "true", "TRUE" and "1" are treated as true; "false", "FALSE" and "0" treated as false; for
nulland other values, returnsdefaultVal. -
toImmutableList
public static <T> Collector<T,com.google.common.collect.ImmutableList.Builder<T>, toImmutableList()com.google.common.collect.ImmutableList<T>> Returns aCollectorthat accumulates the input elements into a GuavaImmutableListvia aImmutableList.Builder.It will be obsolete when we move to Guava 21.0, which has
ImmutableList.toImmutableList().- Type Parameters:
T- Type of the input elements- Returns:
- a
Collectorthat collects all the input elements into anImmutableList, in encounter order
-
shorterThan
Returns whether anIterablehas fewer thannelements.- Type Parameters:
E- Element type
-
skip
Returns all but the first element of a list. -
skip
Returns all but the firstcountelements of a list. -
append
Returns a list with one element appended.- See Also:
-
plus
Prepends an element to a list. -
minus
Removes all occurrences of an element from a list. -
plus
Adds an element to a map. -
plus
Adds an element to a sorted map. -
nextPowerOfTwo
public static int nextPowerOfTwo(int n) Next power of two. -
transform
Lazily transforms a list, applying a mapping function to each element. -
transform
Lazily transforms an Iterable, applying a mapping function to each element. -
transformEager
public static <E,T> com.google.common.collect.ImmutableList<T> transformEager(Iterable<? extends E> elements, Function<E, T> mapper) Eagerly converts an Iterable to an ImmutableList, applying a mapping function to each element. -
transformEager
public static <E,T> com.google.common.collect.ImmutableList<T> transformEager(List<? extends E> elements, Function<E, T> mapper) Eagerly converts a List to an ImmutableList, applying a mapping function to each element. -
intersect
-
str
Flushes a builder and returns its contents.
-