Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.crawler.util
Class Transform<Original,Transformed>

    java.lang.Object
      java.util.AbstractCollection<Transformed>
          org.archive.crawler.util.Transform<Original,Transformed>

Type Parameters:
  `Original` - the type of the original elements in the collection
  `Transformed` - the type of the tranformed elements

All Implemented Interfaces:
  java.lang.Iterable<Transformed>, java.util.Collection<Transformed>

    public class Transform<Original,Transformed>

extends java.util.AbstractCollection<Transformed>

A transformation of a collection. The elements in the transform are based on the elements of some other collection; the original collection's elements are transformed using a specified transformer. Changes to the original collection are automatically reflected in the transform and vice-versa.

If the transformer returns null for a given original object, then that object will not be included in the transform. Thus the transform might be smaller than the original collection. Note that Transform instances can never contain the null element.

This collection implementation does not support the optional add operation.

Author:
  pjack

Constructor Summary
`Transform(java.util.Collection<? extends Original> delegate, Transformer<Original,Transformed> transformer)` Constructor.

Method Summary
`java.util.Iterator<Transformed>` | `iterator()`
`int` | `size()`
`static
`<Target> java.util.Collection<Target>`
` | `subclasses(java.util.Collection<? extends java.lang.Object> c, java.lang.Class<Target> cls)` Returns a transform containing only objects of a given class.

Methods inherited from class java.util.AbstractCollection
`add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Collection
`equals, hashCode`

Constructor Detail

### Transform

    public Transform(java.util.Collection<? extends Original> delegate,
                     Transformer<Original,Transformed> transformer)

  Constructor.

  Parameters:
    `delegate` - The collection whose elements to transform.
    `transformer` - Transforms the elements

Method Detail

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Collection<Transformed>`
  Specified by:
    `size` in class `java.util.AbstractCollection<Transformed>`

### iterator

    public java.util.Iterator<Transformed> iterator()

  Specified by:
    `iterator` in interface `java.lang.Iterable<Transformed>`
  Specified by:
    `iterator` in interface `java.util.Collection<Transformed>`
  Specified by:
    `iterator` in class `java.util.AbstractCollection<Transformed>`

### subclasses

    public static <Target> java.util.Collection<Target> subclasses(java.util.Collection<? extends java.lang.Object> c,
                                                                   java.lang.Class<Target> cls)

  Returns a transform containing only objects of a given class.

  Type Parameters:
    `Target` - the target class
  Parameters:
    `c` - the collection to transform
    `cls` - the class of objects to return
  Returns:
    a collection containing only objects of class cls

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.