List of usage examples for java.util LinkedHashSet forEach
default void forEach(Consumer<? super T> action)
From source file:com.ge.predix.acs.policy.evaluation.cache.AbstractPolicyEvaluationCache.java
private List<String> assembleKeys(final PolicyEvaluationRequestCacheKey key) { List<String> keys = new ArrayList<>(); LinkedHashSet<String> policySetIds = key.getPolicySetIds(); policySetIds.forEach(policySetId -> keys.add(policySetKey(key.getZoneId(), policySetId))); keys.add(resourceKey(key.getZoneId(), key.getResourceId())); keys.add(subjectKey(key.getZoneId(), key.getSubjectId())); keys.add(key.toRedisKey());// w w w . j ava2s . c om return keys; }
From source file:com.ge.predix.acs.policy.evaluation.cache.AbstractPolicyEvaluationCache.java
private void logCacheGetDebugMessages(final PolicyEvaluationRequestCacheKey key, final String redisKey, final List<String> keys, final List<String> values) { if (LOGGER.isDebugEnabled()) { LinkedHashSet<String> policySetIds = key.getPolicySetIds(); policySetIds.forEach(policySetId -> LOGGER .debug(String.format("Getting timestamp for policy set: '%s', key: '%s', timestamp:'%s'.", policySetId, keys.get(0), values.get(0)))); LOGGER.debug(String.format("Getting timestamp for resource: '%s', key: '%s', timestamp:'%s'.", key.getResourceId(), keys.get(1), values.get(1))); LOGGER.debug(String.format("Getting timestamp for subject: '%s', key: '%s', timestamp:'%s'.", key.getSubjectId(), keys.get(2), values.get(2))); LOGGER.debug(String.format("Getting policy evaluation from cache; key: '%s', value: '%s'.", redisKey, values.get(3)));/*from ww w . ja v a 2 s . co m*/ } }
From source file:org.codice.ddf.spatial.ogc.csw.catalog.converter.XstreamPathValueTracker.java
public void buildPaths(LinkedHashSet<Path> paths) { paths.forEach(path -> pathMap.put(path, null)); }
From source file:org.starnub.starnubserver.connections.player.session.PlayerSession.java
public void loadPermissions() { Account account = playerCharacter.getAccount(); LinkedHashSet<String> permissions = new LinkedHashSet<>(); if (account == null) { GroupsManagement.getInstance().getGROUPS().values().stream() .filter(group -> group.getType().equalsIgnoreCase("noaccount")).forEach(group -> { permissions.addAll(group.getGROUP_PERMISSIONS()); });/* w w w .ja v a 2 s .com*/ } else { List<AccountPermission> accountPermissions = AccountPermission.getAccountPermissionsByAccount(account); permissions.addAll( accountPermissions.stream().map(AccountPermission::getPermission).collect(Collectors.toList())); TreeMap<Integer, Group> allGroups = account.getAllGroupsOrderedByRank(); NavigableMap<Integer, Group> navigableMap = allGroups.descendingMap(); for (Group group : navigableMap.values()) { permissions.addAll(group.getGROUP_PERMISSIONS()); } } permissions.forEach(this::addPermissionToMap); }
From source file:starnubserver.connections.player.session.PlayerSession.java
public void loadPermissions() { Account account = playerCharacter.getAccount(); LinkedHashSet<String> permissions = new LinkedHashSet<>(); if (account == null) { GroupsManagement.getInstance().getGROUPS().values().stream() .filter(group -> group.getType().equalsIgnoreCase("noaccount")).forEach(group -> { permissions.addAll(group.getGROUP_PERMISSIONS()); });//from w ww . ja va2 s.c om } else { List<AccountPermission> accountPermissions = AccountPermission.getAccountPermissionsByAccount(account); permissions.addAll( accountPermissions.stream().map(AccountPermission::getPermission).collect(Collectors.toList())); TreeMap<Integer, Group> allGroups = account.getAllGroupsOrderedByRank(); NavigableMap<Integer, Group> navigableMap = allGroups.descendingMap(); for (Group group : navigableMap.values()) { permissions.addAll(group.getGROUP_PERMISSIONS()); } } permissions.forEach(this::addPermissionToMap); System.out.println(PERMISSIONS); }
From source file:utybo.branchingstorytree.swing.editor.StoryNodesEditor.java
public void checkAllAvailable() { ArrayList<StorySingleNodeEditor> seen = new ArrayList<>(); // Because the algorithm used can mark errors twice we use a set to ensure // it only contains each errored element once LinkedHashSet<StorySingleNodeEditor> toMarkAsError = new LinkedHashSet<>(); for (StorySingleNodeEditor ssne : list) { for (StorySingleNodeEditor other : seen) if (other.matchesId(ssne)) { toMarkAsError.add(ssne); toMarkAsError.add(other); break; }/*from ww w .j av a 2 s.c o m*/ seen.add(ssne); } // Turn "seen" into the "everything is ok" list by removing all the errors seen.removeAll(toMarkAsError); seen.forEach(ssne -> { ssne.setStatus(Status.OK); ssne.getId().notifyOk(); }); toMarkAsError.forEach(ssne -> { ssne.setStatus(Status.ERROR); ssne.getId().notifyError(); }); jlist.repaint(); }