Java Code Examples for org.apache.commons.collections4.set.ListOrderedSet#add()
The following examples show how to use
org.apache.commons.collections4.set.ListOrderedSet#add() .
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 |
@SuppressWarnings("unchecked") public static <T> List<T> addWithProperty(Object obj, String propertyName, boolean ignoreNull, 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 (null == t && ignoreNull) { continue; } if (!set.contains(t)) { set.add(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 |
@SuppressWarnings("unchecked") public static <T> List<T> addWithProperty(Object obj, String propertyName, boolean ignoreNull, 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 (null == t && ignoreNull) { continue; } if (!set.contains(t)) { set.add(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 |
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(); } } }
Example 4
Source File: Folder2Factory.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public List<String> listSubNested(String id, String status) throws Exception { ListOrderedSet<String> list = new ListOrderedSet<>(); List<String> subs = this.listSubDirect(id, status); for (String str : subs) { if (!list.contains(str)) { list.add(str); list.addAll(this.listSubNested(str, status)); } } return list.asList(); }
Example 5
Source File: FolderFactory.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public List<String> listSubNested(String id) throws Exception { ListOrderedSet<String> list = new ListOrderedSet<>(); List<String> subs = this.listSubDirect(id); for (String str : subs) { if (!list.contains(str)) { list.add(str); list.addAll(this.listSubNested(str)); } } return list.asList(); }
Example 6
Source File: Folder2Factory.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public List<String> listSubNested(String id, String status) throws Exception { ListOrderedSet<String> list = new ListOrderedSet<>(); List<String> subs = this.listSubDirect(id, status); for (String str : subs) { if (!list.contains(str)) { list.add(str); list.addAll(this.listSubNested(str, status)); } } return list.asList(); }
Example 7
Source File: FolderFactory.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public List<String> listSubNested(String id) throws Exception { ListOrderedSet<String> list = new ListOrderedSet<>(); List<String> subs = this.listSubDirect(id); for (String str : subs) { if (!list.contains(str)) { list.add(str); list.addAll(this.listSubNested(str)); } } return list.asList(); }
Example 8
Source File: StringTools.java From o2oa with GNU Affero General Public License v3.0 | 5 votes |
public static List<String> trimUnique(List<String> list) { ListOrderedSet<String> set = new ListOrderedSet<>(); if ((null != list) && (!list.isEmpty())) { for (String str : list) { if (StringUtils.isNotBlank(str)) { set.add(str); } } } return new ArrayList<String>(set.asList()); }