Class Utils



  • public class Utils
    extends Object
    • Field Detail

    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • stripFileExtension

        public static String stripFileExtension(String name)
        Integer objects are immutable so share all Integers with the same value up to some max size. Use an array as a perfect hash. Return shared object for 0..INTEGER_POOL_MAX_VALUE or a new Integer object with x in it. Java's autoboxing only caches up to 127. public static Integer integer(int x) { if ( x<0 || x>INTEGER_POOL_MAX_VALUE ) { return new Integer(x); } if ( ints[x]==null ) { ints[x] = new Integer(x); } return ints[x]; }
      • sortLinesInString

        public static String sortLinesInString(String s)
      • decapitalize

        public static String decapitalize(String s)
      • select

        public static <From,To> List<To> select(List<From> list,
                                                Utils.Func1<From,To> selector)
        apply methodName to list and return list of results. method has no args. This pulls data out of a list essentially.
      • find

        public static <T> T find(List<?> ops,
                                 Class<T> cl)
        Find exact object type or sublass of cl in list
      • indexOf

        public static <T> int indexOf(List<? extends T> elems,
                                      Utils.Filter<T> filter)
      • lastIndexOf

        public static <T> int lastIndexOf(List<? extends T> elems,
                                          Utils.Filter<T> filter)
      • setSize

        public static void setSize(List<?> list,
                                   int size)