Package com.github.underscore
Class Underscore<T>
- java.lang.Object
-
- com.github.underscore.Underscore<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUnderscore.Chain<T>private static classUnderscore.MyIterable<T>private static classUnderscore.TemplateImpl<K,V>static classUnderscore.ValueThenKeyComparator<K extends Comparable<? super K>,V extends Comparable<? super V>>private static classUnderscore.WherePredicate<E,T>
-
Field Summary
Fields Modifier and Type Field Description private static StringALL_SYMBOLSprivate static longCAPACITY_COEFF_2private static longCAPACITY_SIZE_16private static longCAPACITY_SIZE_5private static StringE_Sprivate static StringESCAPEprivate static Map<Character,String>ESCAPESprivate static StringEVALUATEprivate static PatternFORMAT_PATTERNprivate static Map<String,Function<String,String>>FUNCTIONSprivate static StringINTERPOLATEprivate Iterable<T>iterableprivate static intMIN_PASSWORD_LENGTH_8private static StringS_Qprivate Optional<String>stringprivate static Map<String,String>TEMPLATE_SETTINGSprivate static AtomicIntegerUNIQUE_ID
-
Constructor Summary
Constructors Constructor Description Underscore(Iterable<T> iterable)Underscore(String string)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <E> Supplier<E>after(int count, Supplier<E> function)static <E> booleanall(Iterable<E> iterable, Predicate<E> pred)booleanall(Predicate<T> pred)static <T> Predicate<T>and(Predicate<? super T> pred1, Predicate<? super T> pred2, Predicate<? super T>... rest)static <E> booleanany(Iterable<E> iterable, Predicate<E> pred)booleanany(Predicate<T> pred)static <E> Supplier<E>before(int count, Supplier<E> function)static <E extends Comparable<E>>
intbinarySearch(E[] array, E key)static <E extends Comparable<E>>
intbinarySearch(Iterable<E> iterable, E key)static <T,F>
Function<F,T>bind(Function<F,T> function)Optional<String>call(String funcName)Underscore.Chain<T>chain()static Underscore.Chain<Integer>chain(int[] array)static <T> Underscore.Chain<T>chain(Iterable<T> iterable)static <T> Underscore.Chain<T>chain(Iterable<T> iterable, int size)static <T> Underscore.Chain<T>chain(List<T> list)static Underscore.Chain<Map<String,Object>>chain(Map<String,Object> map)static <T> Underscore.Chain<T>chain(T... array)static <T> TcheckNotNull(T reference)static <T> TcheckNotNull(T reference, Object errorMessage)static <T> List<T>checkNotNullElements(List<T> references)List<List<T>>chunk(int size)List<List<T>>chunk(int size, int step)static <T> List<List<T>>chunk(Iterable<T> iterable, int size)static <T> List<List<T>>chunk(Iterable<T> iterable, int size, int step)List<List<T>>chunkFill(int size, int step, T fillvalue)List<List<T>>chunkFill(int size, T fillvalue)static <T> List<List<T>>chunkFill(Iterable<T> iterable, int size, int step, T fillValue)static <T> List<List<T>>chunkFill(Iterable<T> iterable, int size, T fillValue)static voidclearInterval(ScheduledFuture scheduledFuture)static voidclearTimeout(ScheduledFuture<?> scheduledFuture)static <E> E[]clone(E... iterable)static Objectclone(Object obj)static <T,E>
List<T>collect(List<E> list, Function<? super E,T> func)static <T,E>
Set<T>collect(Set<E> set, Function<? super E,T> func)List<T>compact()static <E> E[]compact(E... array)static <E> E[]compact(E[] array, E falsyValue)static <E> List<E>compact(List<E> list)static <E> List<E>compact(List<E> list, E falsyValue)List<T>compact(T falsyValue)static <T> Function<T,T>compose(Function<T,T>... func)static <T> List<T>concat(Iterable<T> first, Iterable<T>... other)static <T> T[]concat(T[] first, T[]... other)List<T>concatWith(Iterable<T>... other)static <E> Supplier<E>constant(E value)static <E> booleancontains(Iterable<E> iterable, E elem)static <E> booleancontains(Iterable<E> iterable, E elem, int fromIndex)booleancontains(T elem)static <E> booleancontainsAtLeast(Iterable<E> iterable, E value, int count)booleancontainsAtLeast(T value, int count)static <E> booleancontainsAtMost(Iterable<E> iterable, E value, int count)booleancontainsAtMost(T value, int count)static <E> booleancontainsWith(Iterable<E> iterable, E elem)booleancontainsWith(T elem)List<T>copyOf()static <T> List<T>copyOf(Iterable<T> iterable)List<T>copyOfRange(int start, int end)static <T> List<T>copyOfRange(Iterable<T> iterable, int start, int end)static <E> intcount(Iterable<E> iterable, Predicate<E> pred)intcount(Predicate<T> pred)<K> Map<K,Integer>countBy()static <K,E>
Map<K,Integer>countBy(Iterable<E> iterable, Function<E,K> func)static <K> Map<K,Integer>countBy(Iterable<K> iterable)<K,E>
Map<K,Integer>countBy(Function<E,K> func)List<T>cycle(int times)static <T> List<T>cycle(Iterable<T> iterable, int times)static <T> Supplier<T>debounce(Supplier<T> function, int delayMilliseconds)static <K,V>
Map<K,V>defaults(Map<K,V> object, Map<K,V> defaults)static <T> TdefaultTo(T value, T defaultValue)static ScheduledFuture<Void>defer(Runnable runnable)static <T> ScheduledFuture<T>defer(Supplier<T> function)static <T> ScheduledFuture<T>delay(Supplier<T> function, int delayMilliseconds)static <E> Optional<E>detect(Iterable<E> iterable, Predicate<E> pred)static <E> E[]difference(E[]... arrays)static <E> List<E>difference(List<E> list1, List<E> list2)static <E> List<E>difference(List<E> list, List<E>... lists)List<T>differenceWith(List<T>... lists)static <E> E[]distinct(E... array)static <E> List<E>distinct(List<E> list)static <K,E>
E[]distinctBy(E[] array, Function<E,K> func)static <K,E>
Collection<E>distinctBy(Iterable<E> iterable, Function<E,K> func)private static <E> voiddoInvoke(List<Object> args, List<E> result, Method method, E arg)static <E> E[]drop(E... array)static <E> E[]drop(E[] array, int n)static <E> List<E>drop(List<E> list)static <E> List<E>drop(List<E> list, int n)static <T> voideach(Iterable<T> iterable, Consumer<? super T> func)voideach(Consumer<? super T> func)static <T> voideachIndexed(Iterable<T> iterable, BiConsumer<Integer,? super T> func)static <T> voideachRight(Iterable<T> iterable, Consumer<? super T> func)voideachRight(Consumer<? super T> func)TelementAt(int index)static <T> TelementAt(List<T> list, int index)TelementAtOrElse(int index, T defaultValue)static <T> TelementAtOrElse(List<T> list, int index, T defaultValue)TelementAtOrNull(int index)static <T> TelementAtOrNull(List<T> list, int index)static Stringescape(String value)static <E> booleanevery(Iterable<E> iterable, Predicate<E> pred)booleanevery(Predicate<T> pred)static <K,V>
Map<K,V>extend(Map<K,V> destination, Map<K,V>... sources)static <E> List<E>filter(Iterable<E> iterable, Predicate<E> pred)List<T>filter(Predicate<T> pred)static <E> List<E>filter(List<E> list, Predicate<E> pred)static <E> Set<E>filter(Set<E> set, Predicate<E> pred)List<T>filterFalse(Predicate<T> pred)static <E> List<E>filterFalse(List<E> list, Predicate<E> pred)static <E> Set<E>filterFalse(Set<E> set, Predicate<E> pred)static <E> List<E>filterIndexed(List<E> list, PredicateIndexed<E> pred)static <E> Optional<E>find(Iterable<E> iterable, Predicate<E> pred)static <E> intfindIndex(E[] array, Predicate<E> pred)static <E> intfindIndex(List<E> list, Predicate<E> pred)static <E> EfindKey(E[] array, Predicate<E> pred)static <E> EfindKey(List<E> list, Predicate<E> pred)static <E> Optional<E>findLast(Iterable<E> iterable, Predicate<E> pred)static <E> intfindLastIndex(E[] array, Predicate<E> pred)static <E> intfindLastIndex(List<E> list, Predicate<E> pred)static <E> EfindLastKey(E[] array, Predicate<E> pred)static <E> EfindLastKey(List<E> list, Predicate<E> pred)static <T,E>
Optional<E>findWhere(Iterable<E> iterable, List<Tuple<String,T>> properties)<E> Optional<T>findWhere(List<Tuple<String,E>> properties)Tfirst()List<T>first(int n)static <E> Efirst(E... array)static <E> Efirst(Iterable<E> iterable)static <E> Efirst(Iterable<E> iterable, Predicate<E> pred)static <E> List<E>first(Iterable<E> iterable, Predicate<E> pred, int n)Tfirst(Predicate<T> pred)List<T>first(Predicate<T> pred, int n)static <E> List<E>first(List<E> list, int n)TfirstOrNull()static <E> EfirstOrNull(Iterable<E> iterable)static <E> EfirstOrNull(Iterable<E> iterable, Predicate<E> pred)TfirstOrNull(Predicate<T> pred)List<T>flatten()List<T>flatten(boolean shallow)static <E> List<E>flatten(List<?> list)static <E> List<E>flatten(List<?> list, boolean shallow)private static <E> voidflatten(List<?> fromTreeList, List<E> toFlatList, int shallowLevel)static <T,E>
Efoldl(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)static <T,E>
Efoldr(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)static <T> voidforEach(Iterable<T> iterable, Consumer<? super T> func)voidforEach(Consumer<? super T> func)static <T> voidforEachIndexed(Iterable<T> iterable, BiConsumer<Integer,? super T> func)voidforEachIndexed(BiConsumer<Integer,? super T> func)static <T> voidforEachRight(Iterable<T> iterable, Consumer<? super T> func)voidforEachRight(Consumer<? super T> func)static Stringformat(String template, Object... params)static List<String>functions(Object object)Tget(int index)static <T> Tget(List<T> list, int index)private static List<Map.Entry<String,Integer>>getEntries(List<String> reviews, Set<String> competitorsSet, Map<String,Integer> topCompetitorsMap)private static List<Map.Entry<String,Integer>>getEntries(Map<String,Integer> topCompetitorsMap)private static intgetInteger(int rows, int columns, List<List<Integer>> grid, Queue<int[]> queue, int cnt)Iterable<T>getIterable()Optional<String>getString()static <K,E>
Map<K,List<E>>groupBy(Iterable<E> iterable, Function<E,K> func)static <K,E>
Map<K,Optional<E>>groupBy(Iterable<E> iterable, Function<E,K> func, BinaryOperator<E> binaryOperator)<K,E>
Map<K,List<E>>groupBy(Function<E,K> func)<K,E>
Map<K,Optional<E>>groupBy(Function<E,K> func, BinaryOperator<E> binaryOperator)static <K,V>
booleanhas(Map<K,V> object, K key)Thead()List<T>head(int n)static <E> Ehead(E... array)static <E> Ehead(Iterable<E> iterable)static <E> List<E>head(List<E> list, int n)static <E> Eidentity(E value)static <E> booleaninclude(Iterable<E> iterable, E elem)static <K,E>
Map<K,List<E>>indexBy(Iterable<E> iterable, String property)<K,E>
Map<K,List<E>>indexBy(String property)static <E> intindexOf(E[] array, E value)static <E> intindexOf(List<E> list, E value)List<T>initial()List<T>initial(int n)static <E> E[]initial(E... array)static <E> E[]initial(E[] array, int n)static <E> List<E>initial(List<E> list)static <E> List<E>initial(List<E> list, int n)static <T,E>
Einject(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)static <T> List<T>interpose(Iterable<T> iterable, T interElement)List<T>interpose(T element)List<T>interposeByList(Iterable<T> interIter)static <T> List<T>interposeByList(Iterable<T> iterable, Iterable<T> interIter)static <E> E[]intersection(E[]... arrays)static <E> List<E>intersection(List<E> list1, List<E> list2)static <E> List<E>intersection(List<E> list, List<E>... lists)List<T>intersectionWith(List<T>... lists)static <K,V>
List<Tuple<V,K>>invert(Map<K,V> object)static <E> List<E>invoke(Iterable<E> iterable, String methodName)static <E> List<E>invoke(Iterable<E> iterable, String methodName, List<Object> args)List<T>invoke(String methodName)List<T>invoke(String methodName, List<Object> args)static booleanisArray(Object object)static booleanisBoolean(Object object)static booleanisDate(Object object)booleanisEmpty()static <T> booleanisEmpty(Iterable<T> iterable)static <K,V>
booleanisEmpty(Map<K,V> object)static booleanisEqual(Object object, Object other)static booleanisError(Object object)static booleanisFunction(Object object)static <K,V>
booleanisMatch(Map<K,V> object, Map<K,V> properties)booleanisNotEmpty()static <T> booleanisNotEmpty(Iterable<T> iterable)static <K,V>
booleanisNotEmpty(Map<K,V> object)static booleanisNull(Object object)static booleanisNumber(Object object)static booleanisObject(Object object)static booleanisRegExp(Object object)static booleanisString(Object object)static <T> Iterable<T>iterate(T seed, UnaryOperator<T> unaryOperator)static <K,V>
Function<Map<K,V>,V>iteratee(K key)Stringjoin()static <T> Stringjoin(Iterable<T> iterable)static <T> Stringjoin(Iterable<T> iterable, String separator)Stringjoin(String separator)static <T> Stringjoin(T[] array)static <T> Stringjoin(T[] array, String separator)static <K,V>
Set<K>keys(Map<K,V> object)Tlast()List<T>last(int n)static <E> Elast(E... array)Tlast(Predicate<T> pred)static <E> Elast(List<E> list)static <E> List<E>last(List<E> list, int n)static <E> Elast(List<E> list, Predicate<E> pred)static intlastIndex(int[] array)static <T> intlastIndex(Iterable<T> iterable)static <T> intlastIndex(T[] array)static <E> intlastIndexOf(E[] array, E value)static <E> intlastIndexOf(List<E> list, E value)TlastOrNull()TlastOrNull(Predicate<T> pred)static <E> ElastOrNull(List<E> list)static <E> ElastOrNull(List<E> list, Predicate<E> pred)static voidmain(String... args)static <T> List<T>map(int[] array, Function<? super Integer,T> func)<F> List<F>map(Function<? super T,F> func)static <T,E>
List<T>map(List<E> list, Function<? super E,T> func)static <T,E>
Set<T>map(Set<E> set, Function<? super E,T> func)<F> List<F>mapIndexed(BiFunction<Integer,? super T,F> func)static <T,E>
List<T>mapIndexed(List<E> list, BiFunction<Integer,? super E,T> func)static <T,E>
List<T>mapMulti(List<E> list, BiConsumer<? super E,? super Consumer<T>> mapper)static <K,V>
List<Tuple<K,V>>mapObject(Map<K,V> object, Function<? super V,V> func)static <K,V>
Predicate<Map<K,V>>matcher(Map<K,V> object)Tmax()static <E extends Comparable<? super E>>
Emax(Collection<E> collection)static <E,F extends Comparable>
Emax(Collection<E> collection, Function<E,F> func)<F extends Comparable<? super F>>
Tmax(Function<T,F> func)static <T,F>
Function<F,T>memoize(Function<F,T> function)static List<String>methods(Object object)Tmin()static <E extends Comparable<? super E>>
Emin(Collection<E> collection)static <E,F extends Comparable>
Emin(Collection<E> collection, Function<E,F> func)<F extends Comparable<? super F>>
Tmin(Function<T,F> func)static intminimumDays(int rows, int columns, List<List<Integer>> grid)static voidmixin(String funcName, UnaryOperator<String> func)static <E> Predicate<E>negate(Predicate<E> pred)protected static <T> List<T>newArrayList()protected static <T> List<T>newArrayList(Iterable<T> iterable)protected static <T> List<T>newArrayList(Iterable<T> iterable, int size)protected static <T> List<T>newArrayList(T object)protected static <T> List<T>newArrayListWithExpectedSize(int size)protected static List<Integer>newIntegerList(int... array)protected static <K,E>
Map<K,E>newLinkedHashMap()protected static <T> Set<T>newLinkedHashSet()protected static <T> Set<T>newLinkedHashSet(Iterable<T> iterable)protected static <T> Set<T>newLinkedHashSetWithExpectedSize(int size)static booleannonNull(Object obj)static longnow()static <K,V>
List<Tuple<K,V>>object(List<K> keys, List<V> values)Underscore.Chain<T>of()static Underscore.Chain<Integer>of(int[] array)static <T> Underscore.Chain<T>of(Iterable<T> iterable)static <T> Underscore.Chain<T>of(Iterable<T> iterable, int size)static <T> Underscore.Chain<T>of(List<T> list)static <T> Underscore.Chain<T>of(T... array)static <K,V>
List<Tuple<K,V>>omit(Map<K,V> object, Predicate<V> pred)static <K,V>
List<Tuple<K,V>>omit(Map<K,V> object, K... keys)static <T> Supplier<T>once(Supplier<T> function)static <T> Predicate<T>or(Predicate<? super T> pred1, Predicate<? super T> pred2, Predicate<? super T>... rest)static <K,V>
List<Tuple<K,V>>pairs(Map<K,V> object)static <E> List<E>[]partition(E[] iterable, Predicate<E> pred)static <E> List<List<E>>partition(Iterable<E> iterable, Predicate<E> pred)static <K,V>
List<Tuple<K,V>>pick(Map<K,V> object, Predicate<V> pred)static <K,V>
List<Tuple<K,V>>pick(Map<K,V> object, K... keys)List<Object>pluck(String propertyName)static <E> List<Object>pluck(List<E> list, String propertyName)static <E> Set<Object>pluck(Set<E> set, String propertyName)Tuple<T,List<T>>pop()static <T> Tuple<T,List<T>>pop(List<T> list)static <K,V>
Function<Map<K,V>,V>property(K key)static <K,V>
Function<K,V>propertyOf(Map<K,V> object)static <T> List<T>push(List<T> list, T... values)List<T>push(T... values)static intrandom(int max)static intrandom(int min, int max)static List<Character>range(char stop)static List<Character>range(char start, char stop)static List<Character>range(char start, char stop, int step)static List<Integer>range(int stop)static List<Integer>range(int start, int stop)static List<Integer>range(int start, int stop, int step)static <E> Ereduce(int[] array, BiFunction<E,? super Integer,E> func, E zeroElem)static <T,E>
Ereduce(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)static <T> Optional<T>reduce(Iterable<T> iterable, BinaryOperator<T> func)static <T,E>
Ereduce(T[] array, BiFunction<E,T,E> func, E zeroElem)static <E> EreduceRight(int[] array, BiFunction<E,? super Integer,E> func, E zeroElem)static <T,E>
EreduceRight(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)static <T> Optional<T>reduceRight(Iterable<T> iterable, BinaryOperator<T> func)static <T,E>
EreduceRight(T[] array, BiFunction<E,T,E> func, E zeroElem)List<T>reject(Predicate<T> pred)static <E> List<E>reject(List<E> list, Predicate<E> pred)static <E> Set<E>reject(Set<E> set, Predicate<E> pred)static <E> List<E>rejectIndexed(List<E> list, PredicateIndexed<E> pred)static <T> List<T>repeat(T element, int times)static <T> List<T>replace(Iterable<T> iter, Predicate<T> pred, T value)List<T>replace(Predicate<T> pred, T value)List<T>replaceIndexed(PredicateIndexed<T> pred, T value)static <T> List<T>replaceIndexed(Iterable<T> iter, PredicateIndexed<T> pred, T value)List<T>rest()List<T>rest(int n)static <E> E[]rest(E... array)static <E> E[]rest(E[] array, int n)static <E> List<E>rest(List<E> list)static <E> List<E>rest(List<E> list, int n)static <E> Objectresult(Iterable<E> iterable, Predicate<E> pred)List<T>reverse()static List<Integer>reverse(int[] array)static <T> List<T>reverse(Iterable<T> iterable)static <T> T[]reverse(T... array)Tsample()static <E> Esample(Iterable<E> iterable)static <E> Set<E>sample(List<E> list, int howMany)static <E> List<E>select(List<E> list, Predicate<E> pred)static <E> Set<E>select(Set<E> set, Predicate<E> pred)Tuple<T,List<T>>set(int index, T value)static <T> Tuple<T,List<T>>set(List<T> list, int index, T value)static <T> ScheduledFuturesetInterval(Supplier<T> function, int delayMilliseconds)private static voidsetTemplateKey(Map<String,String> templateSettings, String key)static <T> ScheduledFuture<T>setTimeout(Supplier<T> function, int delayMilliseconds)Tuple<T,List<T>>shift()static <T> Tuple<T,List<T>>shift(List<T> list)List<T>shuffle()static <E> List<E>shuffle(Iterable<E> iterable)TsingleOrNull()static <E> EsingleOrNull(Iterable<E> iterable)static <E> EsingleOrNull(Iterable<E> iterable, Predicate<E> pred)TsingleOrNull(Predicate<T> pred)intsize()static <E> intsize(E... array)static intsize(Iterable<?> iterable)List<T>slice(int start)List<T>slice(int start, int end)static <T> List<T>slice(Iterable<T> iterable, int start)static <T> List<T>slice(Iterable<T> iterable, int start, int end)static <T> T[]slice(T[] array, int start)static <T> T[]slice(T[] array, int start, int end)static <E> booleansome(Iterable<E> iterable, Predicate<E> pred)booleansome(Predicate<T> pred)List<Comparable>sort()static <T extends Comparable<T>>
List<T>sort(Iterable<T> iterable)static <T extends Comparable<T>>
T[]sort(T... array)static <E,T extends Comparable<? super T>>
List<E>sortBy(Iterable<E> iterable, Function<E,T> func)static <K,V extends Comparable<? super V>>
List<Map<K,V>>sortBy(Iterable<Map<K,V>> iterable, K key)<E,V extends Comparable<? super V>>
List<E>sortBy(Function<E,V> func)static <E extends Comparable<E>>
intsortedIndex(E[] array, E value)static <E extends Comparable<E>>
intsortedIndex(E[] array, E value, String propertyName)static <E extends Comparable<E>>
intsortedIndex(List<E> list, E value)static <E extends Comparable<E>>
intsortedIndex(List<E> list, E value, String propertyName)static <T extends Comparable<? super T>>
List<T>sortWith(Iterable<T> iterable, Comparator<T> comparator)<E extends Comparable<? super E>>
List<E>sortWith(Comparator<E> comparator)List<List<T>>splitAt(int position)static <T> List<List<T>>splitAt(Iterable<T> iterable, int position)static <T> List<List<T>>splitAt(T[] array, int position)List<T>tail()List<T>tail(int n)static <E> E[]tail(E... array)static <E> E[]tail(E[] array, int n)static <E> List<E>tail(List<E> list)static <E> List<E>tail(List<E> list, int n)List<T>takeSkipping(int stepSize)static <T> List<T>takeSkipping(Iterable<T> iterable, int stepSize)static <T> List<T>takeSkipping(T[] array, int stepSize)static <T> voidtap(Iterable<T> iterable, Consumer<? super T> func)static <K,V>
Template<Map<K,V>>template(String template)static voidtemplateSettings(Map<String,String> templateSettings)static <T> Supplier<T>throttle(Supplier<T> function, int waitMilliseconds)static voidtimes(int count, Runnable runnable)<E> E[]toArray()static <E> E[]toArray(Iterable<E> iterable)Map<T,Integer>toCardinalityMap()static <K> Map<K,Integer>toCardinalityMap(Iterable<K> iterable)<K,V>
Map<K,V>toMap()static <K,V>
Map<K,V>toMap(Iterable<Map.Entry<K,V>> iterable)static <K,V>
Map<K,V>toMap(List<Tuple<K,V>> tuples)static List<String>topNCompetitors(int numCompetitors, int topNCompetitors, List<String> competitors, int numReviews, List<String> reviews)static Stringunescape(String value)static <E> E[]union(E[]... arrays)static <E> List<E>union(List<E> list, List<E>... lists)List<T>unionWith(List<T>... lists)static <E> E[]uniq(E... array)static <K,E>
E[]uniq(E[] array, Function<E,K> func)static <K,E>
Collection<E>uniq(Iterable<E> iterable, Function<E,K> func)static <E> List<E>uniq(List<E> list)static StringuniqueId(String prefix)static StringuniquePassword()static <T> List<T>unshift(List<T> list, T... values)List<T>unshift(T... values)static <T> List<List<T>>unzip(List<T>... lists)Iterable<T>value()static <K,V>
Collection<V>values(Map<K,V> object)<E> List<T>where(List<Tuple<String,E>> properties)static <T,E>
List<E>where(List<E> list, List<Tuple<String,T>> properties)static <T,E>
Set<E>where(Set<E> set, List<Tuple<String,T>> properties)static <E> E[]without(E[] array, E... values)static <E> List<E>without(List<E> list, E... values)static <T> Function<Void,T>wrap(UnaryOperator<T> function, Function<UnaryOperator<T>,T> wrapper)static <T> List<List<T>>zip(List<T>... lists)
-
-
-
Field Detail
-
MIN_PASSWORD_LENGTH_8
private static final int MIN_PASSWORD_LENGTH_8
- See Also:
- Constant Field Values
-
CAPACITY_SIZE_5
private static final long CAPACITY_SIZE_5
- See Also:
- Constant Field Values
-
CAPACITY_COEFF_2
private static final long CAPACITY_COEFF_2
- See Also:
- Constant Field Values
-
CAPACITY_SIZE_16
private static final long CAPACITY_SIZE_16
- See Also:
- Constant Field Values
-
UNIQUE_ID
private static final AtomicInteger UNIQUE_ID
-
ALL_SYMBOLS
private static final String ALL_SYMBOLS
- See Also:
- Constant Field Values
-
EVALUATE
private static final String EVALUATE
- See Also:
- Constant Field Values
-
INTERPOLATE
private static final String INTERPOLATE
- See Also:
- Constant Field Values
-
ESCAPE
private static final String ESCAPE
- See Also:
- Constant Field Values
-
S_Q
private static final String S_Q
- See Also:
- Constant Field Values
-
E_S
private static final String E_S
- See Also:
- Constant Field Values
-
FORMAT_PATTERN
private static final Pattern FORMAT_PATTERN
-
-
Method Detail
-
setTemplateKey
private static void setTemplateKey(Map<String,String> templateSettings, String key)
-
eachIndexed
public static <T> void eachIndexed(Iterable<T> iterable, BiConsumer<Integer,? super T> func)
-
forEachIndexed
public static <T> void forEachIndexed(Iterable<T> iterable, BiConsumer<Integer,? super T> func)
-
forEachIndexed
public void forEachIndexed(BiConsumer<Integer,? super T> func)
-
mapMulti
public static <T,E> List<T> mapMulti(List<E> list, BiConsumer<? super E,? super Consumer<T>> mapper)
-
mapIndexed
public static <T,E> List<T> mapIndexed(List<E> list, BiFunction<Integer,? super E,T> func)
-
replaceIndexed
public static <T> List<T> replaceIndexed(Iterable<T> iter, PredicateIndexed<T> pred, T value)
-
replaceIndexed
public List<T> replaceIndexed(PredicateIndexed<T> pred, T value)
-
mapIndexed
public <F> List<F> mapIndexed(BiFunction<Integer,? super T,F> func)
-
reduce
public static <T,E> E reduce(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)
-
reduce
public static <T> Optional<T> reduce(Iterable<T> iterable, BinaryOperator<T> func)
-
reduce
public static <E> E reduce(int[] array, BiFunction<E,? super Integer,E> func, E zeroElem)
-
reduce
public static <T,E> E reduce(T[] array, BiFunction<E,T,E> func, E zeroElem)
-
foldl
public static <T,E> E foldl(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)
-
inject
public static <T,E> E inject(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)
-
reduceRight
public static <T,E> E reduceRight(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)
-
reduceRight
public static <T> Optional<T> reduceRight(Iterable<T> iterable, BinaryOperator<T> func)
-
reduceRight
public static <E> E reduceRight(int[] array, BiFunction<E,? super Integer,E> func, E zeroElem)
-
reduceRight
public static <T,E> E reduceRight(T[] array, BiFunction<E,T,E> func, E zeroElem)
-
foldr
public static <T,E> E foldr(Iterable<T> iterable, BiFunction<E,T,E> func, E zeroElem)
-
filterIndexed
public static <E> List<E> filterIndexed(List<E> list, PredicateIndexed<E> pred)
-
rejectIndexed
public static <E> List<E> rejectIndexed(List<E> list, PredicateIndexed<E> pred)
-
contains
public static <E> boolean contains(Iterable<E> iterable, E elem)
-
contains
public boolean contains(T elem)
-
containsWith
public static <E> boolean containsWith(Iterable<E> iterable, E elem)
-
containsWith
public boolean containsWith(T elem)
-
contains
public static <E> boolean contains(Iterable<E> iterable, E elem, int fromIndex)
-
containsAtLeast
public boolean containsAtLeast(T value, int count)
-
containsAtMost
public boolean containsAtMost(T value, int count)
-
containsAtLeast
public static <E> boolean containsAtLeast(Iterable<E> iterable, E value, int count)
-
containsAtMost
public static <E> boolean containsAtMost(Iterable<E> iterable, E value, int count)
-
include
public static <E> boolean include(Iterable<E> iterable, E elem)
-
invoke
public static <E> List<E> invoke(Iterable<E> iterable, String methodName, List<Object> args)
-
findWhere
public static <T,E> Optional<E> findWhere(Iterable<E> iterable, List<Tuple<String,T>> properties)
-
max
public static <E extends Comparable<? super E>> E max(Collection<E> collection)
-
max
public T max()
-
max
public static <E,F extends Comparable> E max(Collection<E> collection, Function<E,F> func)
-
max
public <F extends Comparable<? super F>> T max(Function<T,F> func)
-
min
public static <E extends Comparable<? super E>> E min(Collection<E> collection)
-
min
public T min()
-
min
public static <E,F extends Comparable> E min(Collection<E> collection, Function<E,F> func)
-
min
public <F extends Comparable<? super F>> T min(Function<T,F> func)
-
sample
public static <E> E sample(Iterable<E> iterable)
-
sample
public T sample()
-
sortWith
public static <T extends Comparable<? super T>> List<T> sortWith(Iterable<T> iterable, Comparator<T> comparator)
-
sortWith
public <E extends Comparable<? super E>> List<E> sortWith(Comparator<E> comparator)
-
sortBy
public static <E,T extends Comparable<? super T>> List<E> sortBy(Iterable<E> iterable, Function<E,T> func)
-
sortBy
public <E,V extends Comparable<? super V>> List<E> sortBy(Function<E,V> func)
-
sortBy
public static <K,V extends Comparable<? super V>> List<Map<K,V>> sortBy(Iterable<Map<K,V>> iterable, K key)
-
groupBy
public static <K,E> Map<K,Optional<E>> groupBy(Iterable<E> iterable, Function<E,K> func, BinaryOperator<E> binaryOperator)
-
groupBy
public <K,E> Map<K,Optional<E>> groupBy(Function<E,K> func, BinaryOperator<E> binaryOperator)
-
toArray
public static <E> E[] toArray(Iterable<E> iterable)
-
toArray
public <E> E[] toArray()
-
toMap
public <K,V> Map<K,V> toMap()
-
size
public static int size(Iterable<?> iterable)
-
size
public int size()
-
size
public static <E> int size(E... array)
-
singleOrNull
public T singleOrNull()
-
singleOrNull
public static <E> E singleOrNull(Iterable<E> iterable)
-
first
public static <E> E first(Iterable<E> iterable)
-
first
public static <E> E first(E... array)
-
first
public T first()
-
firstOrNull
public static <E> E firstOrNull(Iterable<E> iterable)
-
firstOrNull
public T firstOrNull()
-
head
public static <E> E head(Iterable<E> iterable)
-
head
public static <E> E head(E... array)
-
head
public T head()
-
initial
public static <E> E[] initial(E... array)
-
initial
public static <E> E[] initial(E[] array, int n)
-
last
public static <E> E last(E... array)
-
last
public static <E> E last(List<E> list)
-
last
public T last()
-
lastOrNull
public static <E> E lastOrNull(List<E> list)
-
lastOrNull
public T lastOrNull()
-
rest
public static <E> E[] rest(E... array)
-
rest
public static <E> E[] rest(E[] array, int n)
-
tail
public static <E> E[] tail(E... array)
-
tail
public static <E> E[] tail(E[] array, int n)
-
drop
public static <E> E[] drop(E... array)
-
drop
public static <E> E[] drop(E[] array, int n)
-
compact
public static <E> E[] compact(E... array)
-
compact
public static <E> E[] compact(E[] array, E falsyValue)
-
flatten
private static <E> void flatten(List<?> fromTreeList, List<E> toFlatList, int shallowLevel)
-
without
public static <E> E[] without(E[] array, E... values)
-
uniq
public static <E> E[] uniq(E... array)
-
uniq
public static <K,E> Collection<E> uniq(Iterable<E> iterable, Function<E,K> func)
-
uniq
public static <K,E> E[] uniq(E[] array, Function<E,K> func)
-
distinct
public static <E> E[] distinct(E... array)
-
distinctBy
public static <K,E> Collection<E> distinctBy(Iterable<E> iterable, Function<E,K> func)
-
distinctBy
public static <K,E> E[] distinctBy(E[] array, Function<E,K> func)
-
union
public static <E> E[] union(E[]... arrays)
-
intersection
public static <E> E[] intersection(E[]... arrays)
-
difference
public static <E> E[] difference(E[]... arrays)
-
findIndex
public static <E> int findIndex(E[] array, Predicate<E> pred)
-
findLastIndex
public static <E> int findLastIndex(E[] array, Predicate<E> pred)
-
binarySearch
public static <E extends Comparable<E>> int binarySearch(Iterable<E> iterable, E key)
-
binarySearch
public static <E extends Comparable<E>> int binarySearch(E[] array, E key)
-
sortedIndex
public static <E extends Comparable<E>> int sortedIndex(List<E> list, E value)
-
sortedIndex
public static <E extends Comparable<E>> int sortedIndex(E[] array, E value)
-
sortedIndex
public static <E extends Comparable<E>> int sortedIndex(List<E> list, E value, String propertyName)
-
sortedIndex
public static <E extends Comparable<E>> int sortedIndex(E[] array, E value, String propertyName)
-
indexOf
public static <E> int indexOf(List<E> list, E value)
-
indexOf
public static <E> int indexOf(E[] array, E value)
-
lastIndexOf
public static <E> int lastIndexOf(List<E> list, E value)
-
lastIndexOf
public static <E> int lastIndexOf(E[] array, E value)
-
chunkFill
public static <T> List<List<T>> chunkFill(Iterable<T> iterable, int size, int step, T fillValue)
-
repeat
public static <T> List<T> repeat(T element, int times)
-
interposeByList
public static <T> List<T> interposeByList(Iterable<T> iterable, Iterable<T> interIter)
-
delay
public static <T> ScheduledFuture<T> delay(Supplier<T> function, int delayMilliseconds)
-
defer
public static <T> ScheduledFuture<T> defer(Supplier<T> function)
-
defer
public static ScheduledFuture<Void> defer(Runnable runnable)
-
wrap
public static <T> Function<Void,T> wrap(UnaryOperator<T> function, Function<UnaryOperator<T>,T> wrapper)
-
values
public static <K,V> Collection<V> values(Map<K,V> object)
-
mapObject
public static <K,V> List<Tuple<K,V>> mapObject(Map<K,V> object, Function<? super V,V> func)
-
findKey
public static <E> E findKey(E[] array, Predicate<E> pred)
-
findLastKey
public static <E> E findLastKey(E[] array, Predicate<E> pred)
-
clone
public static <E> E[] clone(E... iterable)
-
isEmpty
public static <K,V> boolean isEmpty(Map<K,V> object)
-
isEmpty
public static <T> boolean isEmpty(Iterable<T> iterable)
-
isEmpty
public boolean isEmpty()
-
isNotEmpty
public static <K,V> boolean isNotEmpty(Map<K,V> object)
-
isNotEmpty
public static <T> boolean isNotEmpty(Iterable<T> iterable)
-
isNotEmpty
public boolean isNotEmpty()
-
isArray
public static boolean isArray(Object object)
-
isObject
public static boolean isObject(Object object)
-
isFunction
public static boolean isFunction(Object object)
-
isString
public static boolean isString(Object object)
-
isNumber
public static boolean isNumber(Object object)
-
isDate
public static boolean isDate(Object object)
-
isRegExp
public static boolean isRegExp(Object object)
-
isError
public static boolean isError(Object object)
-
isBoolean
public static boolean isBoolean(Object object)
-
isNull
public static boolean isNull(Object object)
-
has
public static <K,V> boolean has(Map<K,V> object, K key)
-
identity
public static <E> E identity(E value)
-
constant
public static <E> Supplier<E> constant(E value)
-
times
public static void times(int count, Runnable runnable)
-
random
public static int random(int min, int max)
-
random
public static int random(int max)
-
now
public static long now()
-
uniquePassword
public static String uniquePassword()
-
iterate
public static <T> Iterable<T> iterate(T seed, UnaryOperator<T> unaryOperator)
-
chain
public static <T> Underscore.Chain<T> chain(List<T> list)
-
chain
public static <T> Underscore.Chain<T> chain(Iterable<T> iterable)
-
chain
public static <T> Underscore.Chain<T> chain(Iterable<T> iterable, int size)
-
chain
public static <T> Underscore.Chain<T> chain(T... array)
-
chain
public static Underscore.Chain<Integer> chain(int[] array)
-
chain
public Underscore.Chain<T> chain()
-
of
public static <T> Underscore.Chain<T> of(List<T> list)
-
of
public static <T> Underscore.Chain<T> of(Iterable<T> iterable)
-
of
public static <T> Underscore.Chain<T> of(Iterable<T> iterable, int size)
-
of
public static <T> Underscore.Chain<T> of(T... array)
-
of
public static Underscore.Chain<Integer> of(int[] array)
-
of
public Underscore.Chain<T> of()
-
mixin
public static void mixin(String funcName, UnaryOperator<String> func)
-
sort
public static <T extends Comparable<T>> List<T> sort(Iterable<T> iterable)
-
sort
public static <T extends Comparable<T>> T[] sort(T... array)
-
sort
public List<Comparable> sort()
-
join
public static <T> String join(T[] array)
-
join
public String join()
-
concat
public static <T> T[] concat(T[] first, T[]... other)
-
slice
public static <T> T[] slice(T[] array, int start)
-
slice
public static <T> T[] slice(T[] array, int start, int end)
-
takeSkipping
public static <T> List<T> takeSkipping(T[] array, int stepSize)
-
reverse
public static <T> T[] reverse(T... array)
-
setTimeout
public static <T> ScheduledFuture<T> setTimeout(Supplier<T> function, int delayMilliseconds)
-
clearTimeout
public static void clearTimeout(ScheduledFuture<?> scheduledFuture)
-
setInterval
public static <T> ScheduledFuture setInterval(Supplier<T> function, int delayMilliseconds)
-
clearInterval
public static void clearInterval(ScheduledFuture scheduledFuture)
-
elementAt
public static <T> T elementAt(List<T> list, int index)
-
elementAt
public T elementAt(int index)
-
get
public static <T> T get(List<T> list, int index)
-
get
public T get(int index)
-
elementAtOrElse
public static <T> T elementAtOrElse(List<T> list, int index, T defaultValue)
-
elementAtOrNull
public static <T> T elementAtOrNull(List<T> list, int index)
-
elementAtOrNull
public T elementAtOrNull(int index)
-
lastIndex
public static <T> int lastIndex(Iterable<T> iterable)
-
lastIndex
public static <T> int lastIndex(T[] array)
-
lastIndex
public static int lastIndex(int[] array)
-
checkNotNull
public static <T> T checkNotNull(T reference)
-
checkNotNull
public static <T> T checkNotNull(T reference, Object errorMessage)
-
nonNull
public static boolean nonNull(Object obj)
-
defaultTo
public static <T> T defaultTo(T value, T defaultValue)
-
newArrayList
protected static <T> List<T> newArrayList()
-
newArrayList
protected static <T> List<T> newArrayList(T object)
-
newArrayListWithExpectedSize
protected static <T> List<T> newArrayListWithExpectedSize(int size)
-
newLinkedHashSet
protected static <T> Set<T> newLinkedHashSet()
-
newLinkedHashSetWithExpectedSize
protected static <T> Set<T> newLinkedHashSetWithExpectedSize(int size)
-
newLinkedHashMap
protected static <K,E> Map<K,E> newLinkedHashMap()
-
and
public static <T> Predicate<T> and(Predicate<? super T> pred1, Predicate<? super T> pred2, Predicate<? super T>... rest)
-
or
public static <T> Predicate<T> or(Predicate<? super T> pred1, Predicate<? super T> pred2, Predicate<? super T>... rest)
-
getInteger
private static int getInteger(int rows, int columns, List<List<Integer>> grid, Queue<int[]> queue, int cnt)
-
topNCompetitors
public static List<String> topNCompetitors(int numCompetitors, int topNCompetitors, List<String> competitors, int numReviews, List<String> reviews)
-
getEntries
private static List<Map.Entry<String,Integer>> getEntries(List<String> reviews, Set<String> competitorsSet, Map<String,Integer> topCompetitorsMap)
-
getEntries
private static List<Map.Entry<String,Integer>> getEntries(Map<String,Integer> topCompetitorsMap)
-
main
public static void main(String... args)
-
-