Java Code Examples for org.apache.commons.collections4.set.ListOrderedSet#remove()

The following examples show how to use org.apache.commons.collections4.set.ListOrderedSet#remove() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListTools.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> List<T> subtractWithProperty(Object obj, String propertyName, T... ts) throws Exception {
	List<T> list = new ArrayList<>();
	ListOrderedSet<T> set = new ListOrderedSet<T>();
	Object o = PropertyUtils.getProperty(obj, propertyName);
	if (null != o) {
		set.addAll((List<T>) o);
	}
	for (T t : ts) {
		if (set.contains(t)) {
			set.remove(t);
			list.add(t);
		}
	}
	PropertyUtils.setProperty(obj, propertyName, set.asList());
	return list;
}
 
Example 2
Source File: ListTools.java    From o2oa with GNU Affero General Public License v3.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static <T> List<T> subtractWithProperty(Object obj, String propertyName, List<T> ts) throws Exception {
	List<T> list = new ArrayList<>();
	ListOrderedSet<T> set = new ListOrderedSet<T>();
	Object o = PropertyUtils.getProperty(obj, propertyName);
	if (null != o) {
		set.addAll((List<T>) o);
	}
	if (null != ts) {
		for (T t : ts) {
			if (set.contains(t)) {
				set.remove(t);
				list.add(t);
			}
		}
	}
	PropertyUtils.setProperty(obj, propertyName, set.asList());
	return list;
}
 
Example 3
Source File: IterativeFindPathsAlgorithm.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void unblock(V v) {

		ListOrderedSet<V> toProcess = new ListOrderedSet<>();
		toProcess.add(v);

		while (!toProcess.isEmpty()) {
			V next = toProcess.remove(0);
			Set<V> childBlocked = doUnblock(next);
			if (childBlocked != null && !childBlocked.isEmpty()) {
				toProcess.addAll(childBlocked);
				childBlocked.clear();
			}
		}
	}