elk-util-parent/elk-util-collections/src/main/java/org/semanticweb/elk/util/collections/Operations.java
public static <I, O> Set<O> map(final Set<? extends I> input,
			final FunctorEx<I, O> functor) {
		return new AbstractSet<O>() {

			@Override
			public Iterator<O> iterator() {
				return new MapIterator<I, O>(input.iterator(), functor);
			}

			@Override
			public boolean contains(Object o) {
				I element = functor.deapply(o);

				return element == null ? false : input.contains(element);
			}

			@Override
			public int size() {
				return input.size();
			}

		};
	}
public static <I, O> Set<O> map(final Set<? extends I> input,
			final FunctorEx<I, O> functor) {
		return new AbstractSet<O>() {

			@Override
			public Iterator<O> iterator() {
				return new MapIterator<I, O>(input.iterator(), functor);
			}

			@Override
			public boolean contains(Object o) {
				I element = functor.deapply(o);

				return element == null ? false : input.contains(element);
			}

			@Override
			public int size() {
				return input.size();
			}

		};
	}
A simple second-order map function for sets

@param input
@param functor
@return a set which contains the results of applying the functor to the
elements in the input set