Class LambdaMap<A,B>
- java.lang.Object
-
- com.jnape.palatable.lambda.traversable.LambdaMap<A,B>
-
- Type Parameters:
A
- theMap
element type
- All Implemented Interfaces:
Functor<B,LambdaMap<A,?>>
,Traversable<B,LambdaMap<A,?>>
public final class LambdaMap<A,B> extends java.lang.Object implements Functor<B,LambdaMap<A,?>>, Traversable<B,LambdaMap<A,?>>
- See Also:
LambdaIterable
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <A,B>
LambdaMap<A,B>empty()
Construct an emptyLambdaMap
by wrappingCollections.emptyMap()
boolean
equals(java.lang.Object other)
<C> LambdaMap<A,C>
fmap(Fn1<? super B,? extends C> fn)
Covariantly transmute this functor's parameter using the given mapping function.int
hashCode()
java.lang.String
toString()
<C,App extends Applicative<?,App>,TravC extends Traversable<C,LambdaMap<A,?>>,AppTrav extends Applicative<TravC,App>>
AppTravtraverse(Fn1<? super B,? extends Applicative<C,App>> fn, Fn1<? super TravC,? extends AppTrav> pure)
Applyfn
to each element of this traversable from left to right, and collapse the results into a single resulting applicative, potentially with the assistance of the applicative's pure function.java.util.Map<A,B>
unwrap()
Unwrap the underlyingMap
.static <A,B>
LambdaMap<A,B>wrap(java.util.Map<A,B> map)
Wrap aMap
in aLambdaMap
.
-
-
-
Method Detail
-
fmap
public <C> LambdaMap<A,C> fmap(Fn1<? super B,? extends C> fn)
Description copied from interface:Functor
Covariantly transmute this functor's parameter using the given mapping function. Generally this method is specialized to return an instance of the class implementing Functor.
-
traverse
public <C,App extends Applicative<?,App>,TravC extends Traversable<C,LambdaMap<A,?>>,AppTrav extends Applicative<TravC,App>> AppTrav traverse(Fn1<? super B,? extends Applicative<C,App>> fn, Fn1<? super TravC,? extends AppTrav> pure)
Description copied from interface:Traversable
Applyfn
to each element of this traversable from left to right, and collapse the results into a single resulting applicative, potentially with the assistance of the applicative's pure function.- Specified by:
traverse
in interfaceTraversable<A,B>
- Type Parameters:
C
- the resulting element typeApp
- the result applicative typeTravC
- this Traversable instance over BAppTrav
- the full inferred resulting type from the traversal- Parameters:
fn
- the function to applypure
- the applicative pure function- Returns:
- the traversed Traversable, wrapped inside an applicative
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
wrap
public static <A,B> LambdaMap<A,B> wrap(java.util.Map<A,B> map)
Wrap aMap
in aLambdaMap
.- Type Parameters:
A
- the key typeB
- the value type- Parameters:
map
- theMap
- Returns:
- the
Map
wrapped in aLambdaMap
-
-