List of usage examples for java.util Collections synchronizedNavigableSet
public static <T> NavigableSet<T> synchronizedNavigableSet(NavigableSet<T> s)
From source file:ch.chrigu.datastructures.demo.instances.CollectionInstance.java
/** * The best matching {@link Collections}'s synchronized... function is applied. *///from w ww . j av a 2s.c om private Collection<T> synchronizedCollection(Collection<T> instance) { if (instance instanceof List) { return Collections.synchronizedList((List<T>) instance); } if (instance instanceof Set) { if (instance instanceof NavigableSet) { return Collections.synchronizedNavigableSet((NavigableSet<T>) instance); } return Collections.synchronizedSet((Set<T>) instance); } return Collections.synchronizedCollection(instance); }