List of usage examples for java.util Collection addAll
boolean addAll(Collection<? extends E> c);
From source file:ch.wisv.areafiftylan.products.service.TicketServiceImpl.java
@Override public Collection<Ticket> getOwnedTicketsAndFromTeamMembers(User u) { Collection<Ticket> ownedTickets = ticketRepository.findAllByOwnerUsernameIgnoreCase(u.getUsername()) .stream().filter(Ticket::isValid).collect(Collectors.toList()); Collection<Ticket> captainedTickets = getCaptainedTickets(u); Collection<Ticket> ticketsInControl = new ArrayList<>(); ticketsInControl.addAll(ownedTickets); ticketsInControl.addAll(captainedTickets); return ticketsInControl; }
From source file:hu.bme.mit.sette.common.validator.AbstractValidator.java
/** * Adds the exceptions to the given collection (recursively). * * @param collection//from www . j av a 2 s .co m * the collection */ private void addExceptionsTo(final Collection<ValidationException> collection) { collection.addAll(this.exceptions); for (AbstractValidator<?> v : this.children) { v.addExceptionsTo(collection); } }
From source file:com.adobe.aem.sightly.ide.impl.SightlyBeanFinderImpl.java
/** * write use beans/* www . j a v a2s. c o m*/ * @return */ public void writeUseBeans(JSONWriter writer) throws JSONException { Collection<ClassInfo> sortedBeans = new TreeSet<ClassInfo>(beanComparator); sortedBeans.addAll(beans.values()); writer.object(); for (ClassInfo bean : sortedBeans) { JSONObject classObject = new JSONObject(); classObject.put("members", getMembers(bean.getClassName())); classObject.put("super", bean.getSuperClassName()); writer.key(bean.getClassName()).value(classObject); } writer.endObject(); }
From source file:com.comcast.video.dawg.controller.house.StbModelController.java
/** * REST api to add a model/* w w w . j a v a2 s . com*/ * @param newModel The model to add * @return */ @RequestMapping(value = "models/{id}", method = RequestMethod.POST) @ResponseBody public boolean addModel(@RequestBody DawgModel newModel, @PathVariable String id) { DawgModel existing = service.getModelById(id); service.upsertModel(newModel); if (existing != null) { /** Make a diff between the existing model and the new model * and then apply that diff to every stb that is this * model */ List<String> addedCaps = new ArrayList<String>(); List<String> removedCaps = new ArrayList<String>(); List<String> existingCaps = existing.getCapabilities(); List<String> newCaps = newModel.getCapabilities(); for (String cap : newCaps) { if (!existingCaps.contains(cap)) { addedCaps.add(cap); } } for (String cap : existingCaps) { if (!newCaps.contains(cap)) { removedCaps.add(cap); } } Map<String, Object>[] datas = houseService.getStbsByKey(newModel.getName()); for (Map<String, Object> data : datas) { MetaStb stb = new MetaStb(data); if (stb.getModel().name().equals(newModel.getName())) { if (!stb.getData().containsKey(MetaStb.CAPABILITIES)) { stb.setCapabilities(enumerate(newCaps)); } else { Collection<Capability> caps = stb.getCapabilities(); caps.addAll(enumerate(addedCaps)); caps.removeAll(enumerate(removedCaps)); stb.setCapabilities(caps); } stb.setFamily(Family.valueOf(newModel.getFamily())); houseService.upsertStb(stb); } } } else { Map<String, Object>[] datas = houseService.getStbsByKey(newModel.getName()); applyModels(datas, Arrays.asList(newModel)); } return true; }
From source file:com.linuxbox.enkive.workspace.searchFolder.SearchFolder.java
public Collection<String> getMessageIds() { Collection<String> messageIds = new HashSet<String>(); for (SearchFolderSearchResult result : results) messageIds.addAll(result.getMessageIds()); return messageIds; }
From source file:com.linuxbox.enkive.workspace.searchFolder.SearchFolder.java
public Collection<String> getMessageIds(String sortField, int sortDir) { Collection<String> messageIds = new HashSet<String>(); for (SearchFolderSearchResult result : results) messageIds.addAll(result.getMessageIds()); return messageIds; }
From source file:io.github.minime89.passbeam.keyboard.Keycodes.java
public Collection<Symbol> find(char character) { Collection<Symbol> found = new ArrayList<>(); for (Keycode keycode : keycodes) { Collection<Symbol> symbols = keycode.find(character); found.addAll(symbols); }// ww w . ja va 2 s. com return found; }
From source file:edu.uci.ics.jung.graph.DirectedSparseMultigraph.java
public Collection<E> getIncidentEdges(V vertex) { if (!containsVertex(vertex)) return null; Collection<E> incident = new HashSet<E>(); incident.addAll(getIncoming_internal(vertex)); incident.addAll(getOutgoing_internal(vertex)); return incident; }
From source file:cn.vlabs.umt.ui.rest.RestUserServiceImpl.java
@RestMethod("search") public List<UMTUser> search(String keyword, int offset, int count, String orderBy, boolean isAscendent) { if (keyword == null || keyword.equals("")) { return new ArrayList<UMTUser>(); }/*from ww w . j av a 2 s . c om*/ keyword = keyword.replaceAll("%", ""); if (count <= 0) { count = Integer.MAX_VALUE; } if (offset <= 0) { offset = 0; } UserField field = UserField.cstnetId; if (UMTUser.FIELD_EMAIL.equals(orderBy)) { field = UserField.cstnetId; } if (UMTUser.FIELD_TRUE_NAME.equals(orderBy)) { field = UserField.trueName; } Collection<User> users = new ArrayList<User>(); users.addAll(coreMail.searchByKeyword(keyword, "all", SearchField.CSTNET_ID, offset, count)); users.addAll(coreMail.searchByKeyword(keyword, "all", SearchField.DOMAIN, offset, count)); users.addAll(coreMail.searchByKeyword(keyword, "all", SearchField.TRUE_NAME, offset, count)); Collection<User> umtUsers = service.search(keyword, offset, count, field, isAscendent); if (umtUsers != null) { users.addAll(umtUsers); } ArrayList<UMTUser> rusers = new ArrayList<UMTUser>(); Set<String> repeat = new HashSet<String>(); if (users != null && !users.isEmpty()) { for (User user : users) { if (repeat.contains(user.getCstnetId())) { continue; } repeat.add(user.getCstnetId()); rusers.add(toUMTUser(user)); } } return rusers; }
From source file:com.cloudera.nav.plugin.client.writer.MetadataWriter.java
public void write(Collection<Entity> entities) { Collection<Map<String, Object>> mObjects = Lists.newLinkedList(); for (Entity entity : entities) { mObjects.addAll(getAllMClasses(entity)); }// w w w . j a v a2 s . c om persistMetadataValues(mObjects); }