Class SetUtils

java.lang.Object
org.aksw.commons.collections.SetUtils

public class SetUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> Set<T>
    If the argument is already an instance of a set then cast it to a set and return it; otherwise create a new LinkedHashSet initialized with the given items
    static <K,V> Set<V>
    mapSet(Set<K> set, Map<K,V> map)
    Short hand for Set result = source.stream().map(fn).collect(Collectors.toSet()) Maps a set of keys to a corresponding set of values via a given map TODO Probably this method can be replaced by something from guava
    static <T> Set<T>
    newForwardingSet(Supplier<? extends Set<T>> setSupplier)
     
    static <T> Set<T>
    newLinkedHashSet(Iterator<? extends T> c)
     

    Methods inherited from class Object

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

    • SetUtils

      public SetUtils()
  • Method Details

    • asSet

      public static <T> Set<T> asSet(Iterable<T> c)
      If the argument is already an instance of a set then cast it to a set and return it; otherwise create a new LinkedHashSet initialized with the given items
    • newLinkedHashSet

      public static <T> Set<T> newLinkedHashSet(Iterator<? extends T> c)
    • mapSet

      public static <K,V> Set<V> mapSet(Set<K> set, Map<K,V> map)
      Short hand for Set result = source.stream().map(fn).collect(Collectors.toSet()) Maps a set of keys to a corresponding set of values via a given map TODO Probably this method can be replaced by something from guava
      Parameters:
      set -
      map -
      Returns:
    • newForwardingSet

      public static <T> Set<T> newForwardingSet(Supplier<? extends Set<T>> setSupplier)