Class Static


  • public class Static
    extends Object
    Utilities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean SKIP
      Whether to skip built-in functions.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Static()  
    • 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 boolean getBooleanProperty​(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> boolean shorterThan​(Iterable<E> iterable, int n)
      Returns whether an Iterable has fewer than n elements.
      static <E> List<E> skip​(int count, List<E> list)
      Returns all but the first count elements 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 a Collector that accumulates the input elements into a Guava ImmutableList via a ImmutableList.Builder.
    • Field Detail

      • SKIP

        public static final boolean SKIP
        Whether to skip built-in functions.

        To skip built-in functions, add "-DskipMorelBuiltIns" java's command-line arguments.

    • Constructor Detail

      • Static

        private Static()
    • 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 null and other values, returns defaultVal.

      • toImmutableList

        public static <T> Collector<T,​com.google.common.collect.ImmutableList.Builder<T>,​com.google.common.collect.ImmutableList<T>> toImmutableList()
        Returns a Collector that accumulates the input elements into a Guava ImmutableList via a ImmutableList.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 Collector that collects all the input elements into an ImmutableList, in encounter order
      • shorterThan

        public static <E> boolean shorterThan​(Iterable<E> iterable,
                                              int n)
        Returns whether an Iterable has fewer than n elements.
        Type Parameters:
        E - Element type
      • skip

        public static <E> List<E> skip​(List<E> list)
        Returns all but the first element of a list.
      • skip

        public static <E> List<E> skip​(int count,
                                       List<E> list)
        Returns all but the first count elements 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
      • plus

        public static <E> List<E> plus​(E e,
                                       List<E> list)
        Prepends an element to a list.
      • 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,​V> Map<K,​V> plus​(Map<K,​V> map,
                                                      K k,
                                                      V v)
        Adds an element to a map.
      • 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.