Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* The MIT License (MIT)
*
* Copyright 2015, 2016 Valentyn Kolesnikov
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.github.underscore.math;
import com.github.underscore.Block;
import com.github.underscore.Function1;
import com.github.underscore.FunctionAccum;
import com.github.underscore.Predicate;
import com.github.underscore.Tuple;
import com.github.underscore.Optional;
import java.util.*;
public class $ extends com.github.underscore.$ {
public $(final Iterable iterable) {
super(iterable);
}
public $(final String string) {
super(string);
}
public static class Chain extends com.github.underscore.$.Chain {
public Chain(final T item) {
super(item);
}
public Chain(final List list) {
super(list);
}
public Chain first() {
return new Chain($.first(value()));
}
public Chain first(int n) {
return new Chain($.first(value(), n));
}
public Chain firstOrNull() {
return new Chain($.firstOrNull(value()));
}
public Chain firstOrNull(final Predicate pred) {
return new Chain($.firstOrNull(value(), pred));
}
public Chain initial() {
return new Chain($.initial(value()));
}
public Chain initial(int n) {
return new Chain($.initial(value(), n));
}
public Chain last() {
return new Chain($.last(value()));
}
public Chain last(int n) {
return new Chain($.last(value(), n));
}
public Chain lastOrNull() {
return new Chain($.lastOrNull(value()));
}
public Chain lastOrNull(final Predicate pred) {
return new Chain($.lastOrNull(value(), pred));
}
public Chain rest() {
return new Chain($.rest(value()));
}
public Chain rest(int n) {
return new Chain($.rest(value(), n));
}
public Chain compact() {
return new Chain($.compact(value()));
}
public Chain compact(final T falsyValue) {
return new Chain($.compact(value(), falsyValue));
}
@SuppressWarnings("unchecked")
public Chain flatten() {
return new Chain((List) $.flatten(value()));
}
public Chain map(final Function1 super T, F> func) {
return new Chain($.map(value(), func));
}
public Chain filter(final Predicate pred) {
return new Chain($.filter(value(), pred));
}
public Chain reject(final Predicate pred) {
return new Chain($.reject(value(), pred));
}
public Chain reduce(final FunctionAccum func, final F zeroElem) {
return new Chain($.reduce(value(), func, zeroElem));
}
public Chain reduceRight(final FunctionAccum func, final F zeroElem) {
return new Chain($.reduceRight(value(), func, zeroElem));
}
public Chain> find(final Predicate pred) {
return new Chain>($.find(value(), pred));
}
public Chain> findLast(final Predicate pred) {
return new Chain>($.findLast(value(), pred));
}
@SuppressWarnings("unchecked")
public Chain max() {
return new Chain($.max((Collection) value()));
}
public > Chain max(final Function1 func) {
return new Chain($.max(value(), func));
}
@SuppressWarnings("unchecked")
public Chain min() {
return new Chain($.min((Collection) value()));
}
public > Chain min(final Function1 func) {
return new Chain($.min(value(), func));
}
@SuppressWarnings("unchecked")
public Chain sort() {
return new Chain($.sort((List) value()));
}
public > Chain sortBy(final Function1 func) {
return new Chain($.sortBy(value(), func));
}
@SuppressWarnings("unchecked")
public Chain