Package net.hydromatic.morel.util
Class Static
- java.lang.Object
-
- net.hydromatic.morel.util.Static
-
public class Static extends Object
Utilities.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanSKIPWhether to skip built-in functions.
-
Constructor Summary
Constructors Modifier Constructor Description privateStatic()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <E> List<E>append(List<E> list, E 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>minus(List<E> list, E e)Removes all occurrences of an element from a list.static <E> List<E>plus(E e, List<E> list)Prepends an element to a list.static <K,V>
Map<K,V>plus(Map<K,V> map, K k, V v)Adds an element to a map.static <K extends Comparable<K>,V>
SortedMap<K,V>plus(SortedMap<K,V> map, K k, V 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>skip(int count, List<E> list)Returns all but the firstcountelements of a list.static <E> List<E>skip(List<E> list)Returns all but the first element of a list.static <T> Collector<T,com.google.common.collect.ImmutableList.Builder<T>,com.google.common.collect.ImmutableList<T>>toImmutableList()Returns aCollectorthat accumulates the input elements into a GuavaImmutableListvia aImmutableList.Builder.
-
-
-
Method Detail
-
getBooleanProperty
private static boolean getBooleanProperty(String prop, boolean defaultVal)
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>,com.google.common.collect.ImmutableList<T>> toImmutableList()
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
public static <E> boolean shorterThan(Iterable<E> iterable, int n)
Returns whether anIterablehas fewer thannelements.- Type Parameters:
E- Element type
-
skip
public static <E> List<E> skip(int count, List<E> list)
Returns all but the firstcountelements of a list.
-
append
public static <E> List<E> append(List<E> list, E e)
Returns a list with one element appended.- See Also:
ConsList
-
minus
public static <E> List<E> minus(List<E> list, E e)
Removes all occurrences of an element from a list.
-
plus
public static <K extends Comparable<K>,V> SortedMap<K,V> plus(SortedMap<K,V> map, K k, V v)
Adds an element to a sorted map.
-
-