List of usage examples for java.util List remove
E remove(int index);
From source file:net.chrisrichardson.foodToGo.viewOrdersTransactionScripts.dao.IBatisPagedQueryExecutor.java
public PagedQueryResult execute(String queryName, int startingIndex, int pageSize, OrderSearchCriteria criteria, boolean useRowNum) { List result = executeQuery(queryName, startingIndex, pageSize, criteria, useRowNum); boolean more = result.size() > pageSize; if (more) {//ww w . j a v a 2 s .c o m result.remove(pageSize); } return new PagedQueryResult(result, more); }
From source file:com.haulmont.timesheets.global.WorkTimeConfigBean.java
public List<DayOfWeek> getWeekends() { List<DayOfWeek> days = new ArrayList<>(Arrays.asList(DayOfWeek.values())); for (DayOfWeek day : getWorkDays()) { days.remove(day); }/*from w ww . j a va 2s . c o m*/ return Collections.unmodifiableList(days); }
From source file:com.emc.ecs.sync.test.TestObjectTarget.java
private synchronized void addChild(String parentPath, TestSyncObject object) { List<TestSyncObject> children = getChildren(parentPath); children.remove(object); // in case mkdirs already created a directory that is now being sync'd children.add(object);//from w w w .j av a 2s.c om }
From source file:it.unibas.spicy.model.algebra.operators.NormalizeViewForExecutionPlan.java
public SimpleConjunctiveQuery normalizeView(SimpleConjunctiveQuery view) { if (logger.isDebugEnabled()) logger.debug("Normalizing view: " + view); SimpleConjunctiveQuery result = new SimpleConjunctiveQuery(); List<SetAlias> variablesToAdd = new ArrayList<SetAlias>(view.getVariables()); SetAlias firstVariable = variablesToAdd.remove(0); result.addVariable(firstVariable);//from w ww .j av a2s. co m List<VariableJoinCondition> allJoinsToAdd = new ArrayList<VariableJoinCondition>( view.getAllJoinConditions()); while (!allJoinsToAdd.isEmpty()) { if (logger.isDebugEnabled()) logger.trace("Current view: " + result); if (logger.isDebugEnabled()) logger.trace("Variables to add: " + variablesToAdd); VariableJoinCondition joinToAdd = findAndRemoveFirstJoinOnAddedVariables(allJoinsToAdd, variablesToAdd, result); if (logger.isDebugEnabled()) logger.trace("Join to add: " + joinToAdd); SetAlias variableToAdd = findAndRemoveVariableToAdd(joinToAdd, variablesToAdd); if (logger.isDebugEnabled()) logger.trace("New variable to add: " + joinToAdd); if (variableToAdd == null) { if (logger.isDebugEnabled()) logger.trace("Join is cyclic..."); result.addCyclicJoinCondition(joinToAdd); } else { result.addJoinCondition(joinToAdd); result.addVariable(variableToAdd); } } result.addSelectionConditions(view.getSelectionConditions()); return result; }
From source file:com.webstersmalley.countdown.numbers.NumbersSolver.java
protected Set<Node> getNodes(List<Integer> permutation) { Set<Node> results = new HashSet<Node>(); Node n1 = new IntegerNode(permutation.get(0)); if (permutation.size() == 1) { results.add(n1);/*from ww w . j a v a2 s . com*/ } else { List<Integer> backPerm = new ArrayList<Integer>(); backPerm.addAll(permutation); backPerm.remove(0); Set<Node> backNodes = getNodes(backPerm); for (Node n2 : backNodes) { for (Operator o : Operator.values()) { Node n = getNode(n1, n2, o); if (n != null) { results.add(n); } } } } return results; }
From source file:edu.sjsu.cmpe275.lab2.dao.FriendshipDaoImpl.java
@Override public int delete(long id1, long id2) { int result = 1; Session session = null;/*from w w w.ja va 2s . c om*/ Transaction transaction = null; Person person1 = null, person2 = null; try { session = sessionFactory.openSession(); transaction = session.beginTransaction(); person1 = (Person) session.get(Person.class, id1); person2 = (Person) session.get(Person.class, id2); if (person1 == null || person2 == null) { result = 1; throw new HibernateException("can't find person records with id1 = " + id1 + " and id2 = " + id2); } List<Person> l = person1.getFriends(); if (l.contains(person2)) { l.remove(person2); } l = person2.getFriends(); if (l.contains(person1)) { l.remove(person1); } session.update(person1); session.update(person2); transaction.commit(); result = 0; } catch (HibernateException e) { if (transaction != null) { transaction.rollback(); } } finally { if (session != null) { session.close(); } } return result; }
From source file:com.yalin.fidoclient.op.ASMMessageHandler.java
protected static List<AuthenticatorInfo> parsePolicy(Policy policy, AuthenticatorInfo[] authenticatorInfos) { if (policy == null) { return Arrays.asList(authenticatorInfos); }// ww w. java 2 s . c o m List<AuthenticatorInfo> authenticatorInfoList = new ArrayList<>(); for (AuthenticatorInfo info : authenticatorInfos) { for (MatchCriteria[] criterias : policy.accepted) { boolean setMatch = true; for (MatchCriteria criteria : criterias) { if (!criteria.isMatch(info)) { setMatch = false; break; } } if (setMatch) { authenticatorInfoList.add(info); break; } } } if (policy.disallowed != null) { for (AuthenticatorInfo info : authenticatorInfoList) { for (MatchCriteria matchCriteria : policy.disallowed) { if (matchCriteria.isMatch(info)) { authenticatorInfoList.remove(info); break; } } } } return authenticatorInfoList; }
From source file:name.richardson.james.bukkit.utilities.permissions.BukkitPermissionManager.java
private Permission getParentPermission(final String permissionName) { final List<String> nodes = new LinkedList<String>(Arrays.asList(permissionName.split("\\."))); if (nodes.size() > 1) { nodes.remove(nodes.size() - 1); final String parentNode = StringUtils.join(nodes, "."); logger.log(Level.FINEST, "Resolving parent permission as " + parentNode); return pluginManager.getPermission(parentNode); } else {/*from ww w . j a v a 2 s . c o m*/ return null; } }
From source file:de.static_interface.sinkantispam.command.DeleteWarnCommand.java
@Override protected boolean onExecute(CommandSender sender, String label, String[] args) throws ParseException { if (args.length < 2) { return false; }/* w w w. j a va 2 s . c om*/ IngameUser target = SinkLibrary.getInstance().getIngameUser(args[0]); int id; try { id = Integer.parseInt(args[1]); } catch (Exception e) { return false; } List<Warning> warnings = WarnUtil.getWarnings(target); for (Warning warning : warnings) { if (warning.getId() == id) { warnings.remove(warning); warning.delete(SinkLibrary.getInstance().getUser((Object) sender)); warnings.add(warning); WarnUtil.setWarnings(target, warnings); sender.sendMessage(ChatColor.DARK_GREEN + "Success"); return true; } } sender.sendMessage(ChatColor.DARK_RED + "ID not found: " + id + "!"); return true; }
From source file:cz.muni.fi.mir.db.service.impl.CanonicOutputServiceImpl.java
@Override public void deleteAnnotationFromCanonicOutput(CanonicOutput canonicOutput, Annotation annotation) throws IllegalArgumentException { InputChecker.checkInput(canonicOutput); InputChecker.checkInput(annotation); List<Annotation> temp = new ArrayList<>(canonicOutput.getAnnotations()); temp.remove(annotation); canonicOutput.setAnnotations(temp);// w ww . j a v a 2 s .c om canonicOutputDAO.update(canonicOutput); annotationDAO.delete(annotation.getId()); }