List of usage examples for java.util SortedSet removeAll
boolean removeAll(Collection<?> c);
From source file:net.sf.json.test.JSONAssert.java
private static String unexpectedNames(JSONObject expected, JSONObject actual) { SortedSet keysInActualButNotInExpected = new TreeSet(actual.keySet()); keysInActualButNotInExpected.removeAll(expected.keySet()); if (keysInActualButNotInExpected.isEmpty()) { return null; } else {//from w ww. j a v a 2 s .c om return "unexpected names: [" + StringUtils.join(keysInActualButNotInExpected, ", ") + "]"; } }
From source file:net.sf.json.test.JSONAssert.java
private static String missingExpectedNames(JSONObject expected, JSONObject actual) { SortedSet keysInExpectedButNotInActual = new TreeSet(expected.keySet()); keysInExpectedButNotInActual.removeAll(actual.keySet()); if (keysInExpectedButNotInActual.isEmpty()) { return null; } else {/* w w w .j a v a 2 s. c o m*/ return "missing expected names: [" + StringUtils.join(keysInExpectedButNotInActual, ", ") + "]"; } }
From source file:com.opencredo.portlet.MyBooksController.java
@RequestMapping("EDIT") public String myBooksEditRender(PortletPreferences prefs, Model model) { SortedSet<Book> myBooks = loadMyBooks(prefs); SortedSet<Book> allBooks = bookService.getAllBooks(); allBooks.removeAll(myBooks); model.addAttribute("myBooks", myBooks); model.addAttribute("allBooks", allBooks); return "myBooksEdit"; }
From source file:sample.portlet.MyBooksEditController.java
@Override public ModelAndView handleRenderRequestInternal(RenderRequest request, RenderResponse response) { SortedSet<Book> myBooks = loadMyBooks(request); SortedSet<Book> allBooks = bookService.getAllBooks(); allBooks.removeAll(myBooks); Map<String, Object> model = new HashMap<String, Object>(); model.put("myBooks", myBooks); model.put("allBooks", allBooks); return new ModelAndView("myBooksEdit", model); }
From source file:org.eel.kitchen.jsonschema.keyword.DependenciesKeywordValidator.java
private void computeSimpleDep(final String field, final Set<String> fields, final ValidationReport report) { final Set<String> expected = simple.get(field); final SortedSet<String> missing = Sets.newTreeSet(expected); missing.removeAll(fields); if (missing.isEmpty()) return;//from w w w.j av a 2 s. com final Message.Builder msg = newMsg().setMessage("missing property dependencies").addInfo("property", field) .addInfo("missing", missing).addInfo("expected", Sets.newTreeSet(expected)); report.addMessage(msg.build()); }
From source file:com.vrem.wifianalyzer.wifi.band.WiFiChannelCountryGHZ5.java
SortedSet<Integer> findChannels(@NonNull String countryCode) { SortedSet<Integer> results = new TreeSet<>(channels); SortedSet<Integer> exclude = channelsToExclude.get(StringUtils.capitalize(countryCode)); if (exclude != null) { results.removeAll(exclude); }/*from www. j a v a 2 s .c om*/ return results; }
From source file:com.gammalabs.wifianalyzer.wifi.band.WiFiChannelCountryGHZ5.java
SortedSet<Integer> findChannels(@NonNull String countryCode) { SortedSet<Integer> results = new TreeSet<>(channels); SortedSet<Integer> exclude = channelsToExclude.get(StringUtils.capitalize(countryCode)); if (exclude != null) { results.removeAll(exclude); }//from w w w .j a v a 2s . co m return Collections.unmodifiableSortedSet(results); }
From source file:name.livitski.databag.cli.Syntax.java
@SuppressWarnings("unchecked") public void usage(PrintStream out) { PrintWriter pw = new PrintWriter(out, true); pw.println(getMessage("USAGE")); pw.println();/*from w ww . j a v a2s.co m*/ pw.println(" " + getMessage("SYNTAX")); pw.println(); pw.println(getMessage("COMMANDS")); pw.println(); SortedSet<Option> commands = new TreeSet<Option>(OPTION_COMPARATOR); commands.addAll(COMMAND_OPTION_GROUP.getOptions()); listOptions(commands, pw); pw.println(getMessage("OPTIONS")); pw.println(); SortedSet<Option> options = new TreeSet<Option>(OPTION_COMPARATOR); options.addAll(OPTIONS.getOptions()); options.removeAll(commands); listOptions(options, pw); getHelpFormatter().printWrapped(pw, OUTPUT_WIDTH, getMessage("MORE")); pw.println(); pw.close(); }
From source file:com.aurel.track.item.link.ItemLinkBL.java
/** * Whether a linkSucc is descendant of linkPred for an unidirectional link * @param linkPred/* w w w. j a v a 2s .c om*/ * @param linkSucc * @param direction * @return */ public static boolean isDescendent(Integer linkPred, Integer linkSucc, Integer direction, ILinkType iLinkType) { if (EqualUtils.equal(linkPred, linkSucc)) { return true; } List<Integer> linkTypeIDs = LinkTypeBL.getLinkTypesByPluginClass(iLinkType); List<Integer> workItemIDsFromLevel = new ArrayList<Integer>(); workItemIDsFromLevel.add(linkPred); Set<Integer> linkPredSet = new HashSet<Integer>(); while (!workItemIDsFromLevel.isEmpty()) { Map<Integer, SortedSet<Integer>> predToSuccLinkedWorkItemsMap = loadByWorkItemsAndLinkType( workItemIDsFromLevel, linkTypeIDs, direction, false, null, null); workItemIDsFromLevel = new ArrayList<Integer>(); Iterator<Integer> itrSuccLinkedWorkItemsSet = predToSuccLinkedWorkItemsMap.keySet().iterator(); while (itrSuccLinkedWorkItemsSet.hasNext()) { Integer crtLinkPred = itrSuccLinkedWorkItemsSet.next(); //gather the predecessors from all levels linkPredSet.add(crtLinkPred); SortedSet<Integer> succLinkedWorkItemsSet = predToSuccLinkedWorkItemsMap.get(crtLinkPred); if (succLinkedWorkItemsSet.contains(linkSucc)) { return true; } //remove those successors which were already predecessors in a previous level //if the data is consistent this will never remove any entry, //but if data is not consistent not removing the entry it would lead to infinite cycle succLinkedWorkItemsSet.removeAll(linkPredSet); workItemIDsFromLevel.addAll(succLinkedWorkItemsSet); } } return false; }
From source file:io.lavagna.service.LavagnaImporter.java
/** * Import only the users that are not present in the system. *///from www . j a va 2s . c om private void importMissingUsers(Path tempFile) { List<User> users = readObject("users.json", tempFile, new TypeToken<List<User>>() { }); SortedSet<User> usersToImport = new TreeSet<>(new Comparator<User>() { @Override public int compare(User o1, User o2) { return new CompareToBuilder().append(o1.getProvider(), o2.getProvider()) .append(o1.getUsername(), o2.getUsername()).toComparison(); } }); usersToImport.addAll(users); usersToImport.removeAll(userRepository.findAll()); userRepository.createUsers(usersToImport); }