public static <X,Y> Iterator<Y> map(Function<X, Y> f, Iterator<X> i) { return new MapIterator<>(i, f); }
public static <X,Y> Iterator<Y> map(Function<X, Y> f, Iterator<X> i) { return new MapIterator<>(i, f); }
public static <X,Y> Iterator<Y> map(Function<X, Y> f, Iterator<X> i) { return new MapIterator<>(i, f); }
@Override public Iterator<IClass> iterator() { Function<Node, IClass> toClass = n -> n.klass; return new MapIterator<>(map.values().iterator(), toClass); }
@Override public Iterator<IClass> iterator() { Function<Node, IClass> toClass = n -> n.klass; return new MapIterator<>(map.values().iterator(), toClass); }
/** * Unwrap a Collection of WithState<T> objects, returning a Collection containing the wrapped objects */ private static <T> Collection<T> removeStates(final Collection<? extends WithState<T>> p2SetWithStates) { if (p2SetWithStates == null) { throw new IllegalArgumentException("p2SetWithStates == null"); } Collection<T> finalP2Set = Iterator2Collection.toSet(new MapIterator<WithState<T>, T>(p2SetWithStates.iterator(), WithState::getWrapped)); return finalP2Set; }
/** * Unwrap a Collection of WithState<T> objects, returning a Collection containing the wrapped objects */ private static <T> Collection<T> removeStates(final Collection<? extends WithState<T>> p2SetWithStates) { if (p2SetWithStates == null) { throw new IllegalArgumentException("p2SetWithStates == null"); } Collection<T> finalP2Set = Iterator2Collection.toSet(new MapIterator<WithState<T>, T>(p2SetWithStates.iterator(), WithState::getWrapped)); return finalP2Set; }
public static <X,Y> Set<Y> map(Function<X, Y> f, Collection<X> i) { return Iterator2Collection.toSet(new MapIterator<>(i.iterator(), f)); } }
public static <X,Y> Set<Y> map(Function<X, Y> f, Collection<X> i) { return Iterator2Collection.toSet(new MapIterator<>(i.iterator(), f)); } }
public static <X,Y> Set<Y> map(Function<X, Y> f, Collection<X> i) { return Iterator2Collection.toSet(new MapIterator<>(i.iterator(), f)); } }
public static <T, S extends T> Iterator<S> filter(Iterator<T> iterator, final Class<S> cls) { return new MapIterator<>(new FilterIterator<>(iterator, cls::isInstance), cls::cast); } }
public static <T, S extends T> Iterator<S> filter(Iterator<T> iterator, final Class<S> cls) { return new MapIterator<>(new FilterIterator<>(iterator, cls::isInstance), cls::cast); } }
@Override public Iterator<Row> rows() { return new MapIterator<Row,Row>(base.rows(), new Function<Row,Row>() { @Override public Row apply(final Row arg0) {
public static <T, S extends T> Iterator<S> filter(Iterator<T> iterator, final Class<S> cls) { return new MapIterator<>(new FilterIterator<>(iterator, cls::isInstance), cls::cast); } }
public static void main(String[] args) { @SuppressWarnings("resource") JarFile rt = getRtJar(new MapIterator<>( new FilterIterator<>( new ArrayIterator<>(System.getProperty("sun.boot.class.path").split(File.pathSeparator)), t -> t.endsWith(".jar")), object -> { try { return new JarFile(object); } catch (IOException e) { assert false : e.toString(); return null; } })); System.err.println(rt.getName()); } }
public static void main(String[] args) { @SuppressWarnings("resource") JarFile rt = getRtJar(new MapIterator<>( new FilterIterator<>( new ArrayIterator<>(System.getProperty("sun.boot.class.path").split(File.pathSeparator)), t -> t.endsWith(".jar")), object -> { try { return new JarFile(object); } catch (IOException e) { assert false : e.toString(); return null; } })); System.err.println(rt.getName()); } }
public static void main(String[] args) { @SuppressWarnings("resource") JarFile rt = getRtJar(new MapIterator<>( new FilterIterator<>( new ArrayIterator<>(System.getProperty("sun.boot.class.path").split(File.pathSeparator)), t -> t.endsWith(".jar")), object -> { try { return new JarFile(object); } catch (IOException e) { assert false : e.toString(); return null; } })); System.err.println(rt.getName()); } }
/** * @return the classes that immediately extend klass. if klass is an array class A[][]...[], we return array classes B[][]...[] * (same dimensionality) where B is an immediate subclass of A. If A is primitive, we return the empty set. */ @Override public Collection<IClass> getImmediateSubclasses(IClass klass) { if (klass.isArrayClass()) { return getImmediateArraySubclasses((ArrayClass)klass); } Function<Node, IClass> node2Class = n -> n.klass; return Iterator2Collection.toSet(new MapIterator<>(findNode(klass).children.iterator(), node2Class)); }
@Override public Collection<ISSABasicBlock> getExceptionalPredecessors(ISSABasicBlock b) { if (b == null) { throw new IllegalArgumentException("b is null"); } IBasicBlock<IInstruction> n = delegate.getNode(b.getNumber()); Function<IBasicBlock<IInstruction>, ISSABasicBlock> f = object -> basicBlocks[delegate.getNumber(object)]; return Iterator2Collection.toSet(new MapIterator<>(delegate .getExceptionalPredecessors(n).iterator(), f)); }
/** * @return the classes that immediately extend klass. if klass is an array class A[][]...[], we return array classes B[][]...[] * (same dimensionality) where B is an immediate subclass of A. If A is primitive, we return the empty set. */ @Override public Collection<IClass> getImmediateSubclasses(IClass klass) { if (klass.isArrayClass()) { return getImmediateArraySubclasses((ArrayClass)klass); } Function<Node, IClass> node2Class = n -> n.klass; return Iterator2Collection.toSet(new MapIterator<>(findNode(klass).children.iterator(), node2Class)); }