List of usage examples for java.util List contains
boolean contains(Object o);
From source file:com.app.util.SearchResultUtil.java
private static void _removePreviouslyNotifiedResults(int searchQueryId, List<SearchResult> newSearchResults) throws DatabaseConnectionException, SQLException { List<String> searchQueryPreviousResults = SearchQueryPreviousResultUtil .getSearchQueryPreviousResults(searchQueryId); if (!searchQueryPreviousResults.isEmpty()) { Iterator iterator = newSearchResults.iterator(); while (iterator.hasNext()) { SearchResult searchResult = (SearchResult) iterator.next(); if (searchQueryPreviousResults.contains(searchResult.getItemId())) { iterator.remove();/*from www . j a va 2s .c o m*/ } } } }
From source file:gov.nih.nci.ncicb.tcga.dcc.qclive.QcliveAbstractBaseIntegrationTest.java
/** * Check all files under the given path and delete them if they are not in the given list of valid paths * * @param path the path where to start checking the paths validity (this one included) * @param validPaths the list of valid paths *//* w w w. j a v a 2 s . com*/ private static void cleanPath(final String path, final List<String> validPaths) { // Delete path if not valid final File file = new File(path); if (!validPaths.contains(file.getAbsolutePath())) { final boolean isDeleted = FileUtil.deleteDir(file); if (!isDeleted) { fail("Could not delete file '" + file.getAbsolutePath() + "'"); } } // Recursively clean children (don't try this at home) if (file.isDirectory()) { final String[] children = file.list(); for (final String child : children) { cleanPath(path + File.separator + child, validPaths); } } }
From source file:de._13ducks.cor.game.server.movement.SectorPathfinder.java
private static List<Node> computeNeighbors(Node current, Node target, List<Node> preTargetNodes) { List<Node> originalNodes = current.getReachableNodes(); if (preTargetNodes.contains(current)) { originalNodes.add(target);/*from ww w . ja va 2s .c o m*/ } return originalNodes; }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Add Other to the list in the first spot if it's not already there. * Removes it and put's it in the first spot if it is. *///from w w w.ja v a 2s . c om private static void addOther(List inList) { if (!inList.contains(Constants.Dropdowns.OTHER_OPTION)) { inList.add(0, Constants.Dropdowns.OTHER_OPTION); } else { inList.remove(Constants.Dropdowns.OTHER_OPTION); inList.add(0, Constants.Dropdowns.OTHER_OPTION); } }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Add Not Specified to the list in the first spot if it's not already there. * Removes it and put's it in the second spot if it is. *//*from w w w . j a v a2 s .c o m*/ private static void addNotSpecified(List inList) { if (!inList.contains(Constants.Dropdowns.NOT_SPECIFIED_OPTION)) { inList.add(0, Constants.Dropdowns.NOT_SPECIFIED_OPTION); } else { inList.remove(Constants.Dropdowns.NOT_SPECIFIED_OPTION); inList.add(0, Constants.Dropdowns.NOT_SPECIFIED_OPTION); } }
From source file:gov.nih.nci.caIMAGE.util.NewDropdownUtil.java
/** * Add "" to the list in the first spot if it's not already there. Removes * it and put's it in the first spot if it is. *///from w w w . jav a 2 s . c o m private static void addBlank(List inList) { if (!inList.contains("")) { inList.add(0, ""); } else { inList.remove(""); inList.add(0, ""); } }
From source file:br.ufpr.inf.opla.patterns.util.AdapterUtil.java
public static List<Interface> getAllTargetInterfaces(Element adaptee) { List<Interface> targetInterfaces = new ArrayList<>(); List<Element> adapteeSuperElements = ElementUtil.getAllSuperElements(adaptee); adapteeSuperElements.add(adaptee);/*from w w w . j a va 2 s.c o m*/ List<Relationship> allRelationships = ElementUtil.getRelationships(adapteeSuperElements); for (Relationship relationship : allRelationships) { Element usedElementFromRelationship = RelationshipUtil.getUsedElementFromRelationship(relationship); if (usedElementFromRelationship != null && adapteeSuperElements.contains(usedElementFromRelationship)) { Element client = RelationshipUtil.getClientElementFromRelationship(relationship); if (client instanceof Class && !((Class) client).isAbstract()) { List<Interface> allSuperInterfaces = ElementUtil.getAllSuperInterfaces(client); allSuperInterfaces.remove(adaptee); allSuperInterfaces.removeAll(adapteeSuperElements); targetInterfaces = new ArrayList<>(CollectionUtils.union(targetInterfaces, allSuperInterfaces)); } } } return targetInterfaces; }
From source file:fr.xebia.audit.AuditAspect.java
protected static void appendThrowableCauses(Throwable throwable, String separator, StringBuilder toAppendTo) { List<Throwable> alreadyAppendedThrowables = new ArrayList<Throwable>(); while (throwable != null) { // append toAppendTo.append(throwable.toString()); alreadyAppendedThrowables.add(throwable); // cause/*from w w w. ja v a 2 s . co m*/ Throwable cause = throwable.getCause(); if (cause == null || alreadyAppendedThrowables.contains(cause)) { break; } else { throwable = cause; toAppendTo.append(separator); } } }
From source file:fr.cph.chicago.util.Util.java
/** * Add to bus favorites//from w ww .ja va 2 s .co m * * @param busRouteId the bus route id * @param busStopId the bus stop id * @param bound the bus bound * @param view the view */ public static void addToBusFavorites(@NonNull final String busRouteId, @NonNull final String busStopId, @NonNull final String bound, @NonNull final View view) { final String id = busRouteId + "_" + busStopId + "_" + bound; final List<String> favorites = Preferences.getBusFavorites(view.getContext(), App.PREFERENCE_FAVORITES_BUS); if (!favorites.contains(id)) { favorites.add(id); Preferences.saveBusFavorites(view.getContext(), App.PREFERENCE_FAVORITES_BUS, favorites); showSnackBar(view, R.string.message_add_fav); } }
From source file:org.fao.fenix.wds.core.utils.olap.OLAPWrapper.java
private static List<String> findAllItems(List<List<String>> t, String element, String area) { List<String> l = new ArrayList<String>(); int idx = 2;/*from w w w.j ava 2 s . c om*/ for (int i = 1; i < t.size(); i++) if (t.get(i).get(0).equalsIgnoreCase(element) && t.get(i).get(1).equalsIgnoreCase(area) && !l.contains(t.get(i).get(idx))) l.add(t.get(i).get(idx)); return l; }