org.shapelogic.calculation
Class CollectionCalc

java.lang.Object
  extended by org.shapelogic.calculation.CollectionCalc

public class CollectionCalc
extends java.lang.Object

Normal functional operations used on Java Collections.
Done as eager operations opposed to stream that are done as lazy operations.
Add these operations as they are needed.

Author:
Sami Badawi

Constructor Summary
CollectionCalc()
           
 
Method Summary
static
<In> java.util.Collection<In>
filter(java.util.Collection<In> collection, Calc1<In,java.lang.Boolean> predicateCalc)
          Normal filter with predicate as a Calc1.
static
<In> java.util.Collection<In>
filter(java.util.Collection<In> collection, Predicate<In> calc)
          Normal filter.
static
<In,Out> java.util.Collection<Out>
map(java.util.Collection<In> collection, Calc1<In,Out> calc)
          Normal map operations.
Maybe there is a better name to use in Java.
static
<In,Out> java.util.Collection<Out>
map(java.util.Collection<In> collection, CalcIndex1<In,Out> calc)
          Index map operations.
Maybe there is a better name to use in Java.
static
<E extends java.lang.Comparable<? super E>>
java.util.List<E>
mergeSorted(java.util.List<E> input1, java.util.List<E> input2)
          Normal merge of sorted lists.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionCalc

public CollectionCalc()
Method Detail

map

public static <In,Out> java.util.Collection<Out> map(java.util.Collection<In> collection,
                                                     Calc1<In,Out> calc)
Normal map operations.
Maybe there is a better name to use in Java.

Type Parameters:
In -
Out -
Parameters:
collection -
calc -
Returns:

map

public static <In,Out> java.util.Collection<Out> map(java.util.Collection<In> collection,
                                                     CalcIndex1<In,Out> calc)
Index map operations.
Maybe there is a better name to use in Java.

Type Parameters:
In -
Out -
Parameters:
collection -
calc -
Returns:

filter

public static <In> java.util.Collection<In> filter(java.util.Collection<In> collection,
                                                   Calc1<In,java.lang.Boolean> predicateCalc)
Normal filter with predicate as a Calc1.

Type Parameters:
In -
Parameters:
collection -
predicateCalc -
Returns:
ArrayList

filter

public static <In> java.util.Collection<In> filter(java.util.Collection<In> collection,
                                                   Predicate<In> calc)
Normal filter.

Type Parameters:
In -
Parameters:
collection -
predicate -
Returns:
ArrayList

mergeSorted

public static <E extends java.lang.Comparable<? super E>> java.util.List<E> mergeSorted(java.util.List<E> input1,
                                                                                        java.util.List<E> input2)
Normal merge of sorted lists.
No duplicates.



Copyright © 2009. All Rights Reserved.