Class IterableLens


  • public final class IterableLens
    extends java.lang.Object
    Lenses that operate on Iterables.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private IterableLens()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <A> Lens.Simple<java.lang.Iterable<A>,​Maybe<A>> head()
      A lens focusing on the head of a given Iterable.
      static <A,​B>
      Iso.Simple<java.lang.Iterable<A>,​java.lang.Iterable<B>>
      mapping​(Iso<A,​A,​B,​B> abIso)
      An iso focusing on the mapped values of an Iterable.
      static <A> Lens.Simple<java.lang.Iterable<A>,​java.lang.Iterable<A>> tail()
      A lens focusing on the tail of an Iterable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IterableLens

        private IterableLens()
    • Method Detail

      • head

        public static <A> Lens.Simple<java.lang.Iterable<A>,​Maybe<A>> head()
        A lens focusing on the head of a given Iterable.

        Note that this lens is effectively lawful, though difficult to prove since there is no useful equality implementation for Iterable.

        Type Parameters:
        A - the Iterable element type
        Returns:
        a lens focusing on the head element of an Iterable
      • tail

        public static <A> Lens.Simple<java.lang.Iterable<A>,​java.lang.Iterable<A>> tail()
        A lens focusing on the tail of an Iterable.
        Type Parameters:
        A - the Iterable element type
        Returns:
        a lens focusing on the tail of an Iterable
      • mapping

        public static <A,​B> Iso.Simple<java.lang.Iterable<A>,​java.lang.Iterable<B>> mapping​(Iso<A,​A,​B,​B> abIso)
        An iso focusing on the mapped values of an Iterable.
        Type Parameters:
        A - the unmapped Iterable element type
        B - the mapped Iterable element type
        Parameters:
        abIso - the iso from A to B
        Returns:
        an iso that maps Iterable<A> to Iterable<B>