List of usage examples for java.util Set clear
void clear();
From source file:org.jtalks.poulpe.util.databasebackup.persistence.DbTableKeys.java
/** * Obtain from the database a list of tables' unique keys. * /*from w w w . j a va2 s .co m*/ * @return A list of {@link UniqueKey} object represented unique keys. * @throws SQLException * Is thrown in case any errors during work with database occur. */ @SuppressWarnings("unchecked") public Set<UniqueKey> getUniqueKeys() throws SQLException { Set<UniqueKey> tableUniqueKeySet = null; try { tableUniqueKeySet = (Set<UniqueKey>) JdbcUtils.extractDatabaseMetaData(dataSource, new KeyListProcessor(tableName, new TableKeyPerformer() { @Override public ResultSet getResultSet(DatabaseMetaData dmd, String tableName) throws SQLException { return dmd.getIndexInfo(null, null, tableName, true, true); } @Override public void addKeyToSet(ResultSet rs, Set<TableKey> keySet) throws SQLException { if (rs.getString(INDEX_NAME) != null && rs.getString(COLUMN_NAME) != null) { UniqueKey key = new UniqueKey(rs.getString(INDEX_NAME), rs.getString(COLUMN_NAME)); if (!isPrimaryKey(key)) { keySet.add(key); } } } })); Map<String, UniqueKey> resultMap = new HashMap<String, UniqueKey>(); for (UniqueKey uniqueKey : tableUniqueKeySet) { if (resultMap.containsKey(uniqueKey.getIndexName())) { Set<String> existingColumns = new HashSet<String>( resultMap.get(uniqueKey.getIndexName()).getColumnNameSet()); existingColumns.addAll(uniqueKey.getColumnNameSet()); resultMap.put(uniqueKey.getIndexName(), new UniqueKey(uniqueKey.getIndexName(), existingColumns)); } else { resultMap.put(uniqueKey.getIndexName(), uniqueKey); } } tableUniqueKeySet.clear(); for (UniqueKey key : resultMap.values()) { tableUniqueKeySet.add(key); } } catch (MetaDataAccessException e) { throw new SQLException(e); } return tableUniqueKeySet; }
From source file:com.l2jfree.gameserver.datatables.SkillTable.java
private SkillTable() { final List<L2Skill> skills = DocumentEngine.loadSkills(); _log.info("SkillTable: Loaded " + skills.size() + " skill templates from XML files."); int highestId = 0; for (L2Skill skill : skills) if (highestId < skill.getId()) highestId = skill.getId();// w w w .j av a 2 s. c o m _maxLevels = new int[highestId + 1]; int[] highestLevels = new int[highestId + 1]; for (L2Skill skill : skills) { if (highestLevels[skill.getId()] < skill.getLevel()) highestLevels[skill.getId()] = skill.getLevel(); if (_maxLevels[skill.getId()] < skill.getLevel() && skill.getLevel() < 100) _maxLevels[skill.getId()] = skill.getLevel(); } // clear previously stored skills for (SkillInfo[] infos : SKILL_INFOS) if (infos != null) for (SkillInfo info : infos) if (info != null) info._skill = null; _skillTable = new L2Skill[highestId + 1][]; SKILL_INFOS = Arrays.copyOf(SKILL_INFOS, Math.max(SKILL_INFOS.length, highestId + 1)); for (int i = 0; i < highestLevels.length; i++) { final int highestLevel = highestLevels[i]; if (highestLevel < 1) continue; _skillTable[i] = new L2Skill[highestLevel + 1]; if (SKILL_INFOS[i] == null) SKILL_INFOS[i] = new SkillInfo[highestLevel + 1]; else SKILL_INFOS[i] = Arrays.copyOf(SKILL_INFOS[i], Math.max(SKILL_INFOS[i].length, highestLevel + 1)); } for (L2Skill skill : skills) { _skillTable[skill.getId()][skill.getLevel()] = skill; if (SKILL_INFOS[skill.getId()][skill.getLevel()] == null) SKILL_INFOS[skill.getId()][skill.getLevel()] = new SkillInfo(skill.getId(), skill.getLevel()); SKILL_INFOS[skill.getId()][skill.getLevel()]._skill = skill; } int length = _skillTable.length; for (L2Skill[] array : _skillTable) if (array != null) length += array.length; _log.info("SkillTable: Occupying arrays for " + length + "."); SingletonHolder.INSTANCE = this; Map<Integer, L2Skill> skillsByUID = new HashMap<Integer, L2Skill>(); for (L2Skill skill : skills) { try { L2Skill old = skillsByUID.put(SkillTable.getSkillUID(skill), skill); if (old != null) _log.warn("Overlapping UIDs for: " + old + ", " + skill, new IllegalStateException()); skill.validate(); } catch (Exception e) { _log.warn(skill, e); } } for (L2Skill skill0 : skills) { if (!(skill0 instanceof L2SkillLearnSkill)) continue; L2SkillLearnSkill skill = (L2SkillLearnSkill) skill0; for (int i = 0; i < skill.getNewSkillId().length; i++) { final L2Skill learnedSkill = getInfo(skill.getNewSkillId()[i], skill.getNewSkillLvl()[i]); if (learnedSkill != null) _learnedSkills.add(learnedSkill); } } // checking for skill enchantment mismatch // in XMLs final TreeSet<String> skillEnchantsInXMLs = new TreeSet<String>(); // reusing final Map<Integer, Set<Integer>> enchantLevelsByEnchantType = new HashMap<Integer, Set<Integer>>(); for (int skillId = 0; skillId < _skillTable.length; skillId++) { final L2Skill[] skillsById = _skillTable[skillId]; if (skillsById == null) continue; for (final L2Skill skill : skillsById) { if (skill == null || skill.getLevel() < 100) continue; final int enchantType = skill.getLevel() / 100; final int enchantLevel = skill.getLevel() % 100; Set<Integer> enchantLevels = enchantLevelsByEnchantType.get(enchantType); if (enchantLevels == null) enchantLevelsByEnchantType.put(enchantType, enchantLevels = new FastSet<Integer>(30)); enchantLevels.add(enchantLevel); } for (Map.Entry<Integer, Set<Integer>> entry : enchantLevelsByEnchantType.entrySet()) { final int enchantType = entry.getKey(); final Set<Integer> enchantLevels = entry.getValue(); if (enchantLevels.isEmpty()) continue; final String s = "Skill ID: " + skillId + " - EnchantType: enchant" + enchantType + " - Levels: " + enchantLevels.size(); boolean valid = true; for (int skillLvl = 1; skillLvl <= 30; skillLvl++) { if (!enchantLevels.remove(skillLvl)) { if (skillLvl == 16 && enchantLevels.isEmpty()) break; _log.warn("Missing skill enchant level in XMLs for " + s + " - Level: " + skillLvl); valid = false; } } if (!enchantLevels.isEmpty()) _log.warn("Extra skill enchant levels in XMLs for " + s + " - Levels: " + enchantLevels); else if (valid) skillEnchantsInXMLs.add(s); // reusing enchantLevels.clear(); } } // in database final TreeSet<String> skillEnchantsInDatabase = new TreeSet<String>(); for (L2EnchantSkillLearn skillLearn : SkillTreeTable.getInstance().getSkillEnchantments()) { final int skillId = skillLearn.getId(); final List<EnchantSkillDetail>[] details = skillLearn.getEnchantRoutes(); if (details.length == 0) _log.warn("Invalid skill enchant data in database for Skill ID: " + skillId); for (int indexingEnchantType = 0; indexingEnchantType < details.length; indexingEnchantType++) { final List<EnchantSkillDetail> route = details[indexingEnchantType]; if (route == null) continue; final String s = "Skill ID: " + skillId + " - EnchantType: enchant" + (indexingEnchantType + 1) + " - Levels: " + route.size(); if (route.size() != 30 && route.size() != 15) _log.warn("Invalid skill enchant data in database for " + s); else skillEnchantsInDatabase.add(s); } } // comparing the results for (String skillEnchant : skillEnchantsInXMLs) if (!skillEnchantsInDatabase.remove(skillEnchant)) _log.warn("Missing skill enchant data in database for " + skillEnchant); for (String skillEnchant : skillEnchantsInDatabase) _log.warn("Missing skill enchant data in XMLs for " + skillEnchant); // just validation for (L2EnchantSkillLearn skillLearn : SkillTreeTable.getInstance().getSkillEnchantments()) { final int skillId = skillLearn.getId(); final List<EnchantSkillDetail>[] details = skillLearn.getEnchantRoutes(); final int maxLevel = getMaxLevel(skillId); if (skillLearn.getBaseLevel() != maxLevel) _log.warn("Invalid `base_lvl` skill enchant data in database for Skill ID: " + skillId); for (int indexingEnchantType = 0; indexingEnchantType < details.length; indexingEnchantType++) { final List<EnchantSkillDetail> route = details[indexingEnchantType]; if (route == null) continue; final String s = "Skill ID: " + skillId + " - EnchantType: enchant" + (indexingEnchantType + 1) + " - Levels: " + route.size(); int index = 1; int expectedMinSkillLevel = maxLevel; for (EnchantSkillDetail detail : route) { if (detail.getLevel() % 100 != index) _log.warn("Invalid `level` skill enchant data in database for " + s); if (detail.getMinSkillLevel() != expectedMinSkillLevel) _log.warn("Invalid `min_skill_lvl` skill enchant data in database for " + s); index++; expectedMinSkillLevel = detail.getLevel(); } } } }
From source file:com.liveramp.hank.storage.curly.TestAbstractCurlyPartitionUpdater.java
@Test public void testGetCachedVersions() throws IOException { Set<DomainVersion> versions = new HashSet<DomainVersion>(); updater.ensureCacheExists();/* w ww .j a v a2 s . c om*/ // Empty cache assertEquals(versions, updater.detectCachedBases()); assertEquals(versions, updater.detectCachedDeltas()); // Do not consider cueball files only makeLocalCacheFile("00001.base.cueball"); assertEquals(Collections.<DomainVersion>emptySet(), updater.detectCachedBases()); assertEquals(Collections.<DomainVersion>emptySet(), updater.detectCachedDeltas()); deleteLocalCacheFile("00001.base.cueball"); // Delta only makeLocalCacheFile("00001.delta.cueball"); makeLocalCacheFile("00001.delta.curly"); assertEquals(Collections.<DomainVersion>emptySet(), updater.detectCachedBases()); assertEquals(Collections.<DomainVersion>singleton(v1), updater.detectCachedDeltas()); deleteLocalCacheFile("00001.delta.cueball"); deleteLocalCacheFile("00001.delta.curly"); // Use bases makeLocalCacheFile("00000.base.cueball"); makeLocalCacheFile("00000.base.curly"); assertEquals(Collections.<DomainVersion>singleton(v0), updater.detectCachedBases()); assertEquals(Collections.<DomainVersion>emptySet(), updater.detectCachedDeltas()); deleteLocalCacheFile("00000.base.cueball"); deleteLocalCacheFile("00000.base.curly"); // Use multiple bases makeLocalCacheFile("00000.base.cueball"); makeLocalCacheFile("00000.base.curly"); makeLocalCacheFile("00001.base.cueball"); makeLocalCacheFile("00001.base.curly"); versions.add(v0); versions.add(v1); assertEquals(versions, updater.detectCachedBases()); assertEquals(Collections.<DomainVersion>emptySet(), updater.detectCachedDeltas()); versions.clear(); deleteLocalCacheFile("00000.base.cueball"); deleteLocalCacheFile("00000.base.curly"); deleteLocalCacheFile("00001.base.cueball"); deleteLocalCacheFile("00001.base.curly"); }
From source file:org.apache.hadoop.raid.DistBlockIntegrityMonitor.java
public static Job startOneJob(Worker newWorker, Priority pri, Set<String> jobFiles, long detectTime, AtomicLong numFilesSubmitted, AtomicLong lastCheckingTime, long maxPendingJobs) throws IOException, InterruptedException, ClassNotFoundException { if (lastCheckingTime != null) { lastCheckingTime.set(System.currentTimeMillis()); }/*from ww w. j ava 2 s.c om*/ String startTimeStr = dateFormat.format(new Date()); String jobName = newWorker.JOB_NAME_PREFIX + "." + newWorker.jobCounter + "." + pri + "-pri" + "." + startTimeStr; Job job = null; synchronized (jobFiles) { if (jobFiles.size() == 0) { return null; } newWorker.jobCounter++; synchronized (newWorker.jobIndex) { if (newWorker.jobIndex.size() >= maxPendingJobs) { // full return null; } job = newWorker.startJob(jobName, jobFiles, pri, detectTime); } numFilesSubmitted.addAndGet(jobFiles.size()); jobFiles.clear(); } return job; }
From source file:net.sf.jclal.sampling.unsupervised.Resample.java
/** * creates the subsample with replacement * * @param dataSet The dataset to extract a percent of instances * @param sampleSize the size to generate *//* w w w .j a v a 2 s . c o m*/ public void createSubsampleWithReplacement(IDataset dataSet, int sampleSize) { int origSize = dataSet.getNumInstances(); Set<Integer> indexes = new HashSet<Integer>(); Instances labeledInstances = new Instances(dataSet.getDataset(), sampleSize); //Fill the labeled set for (int i = 0; i < sampleSize; i++) { int index = getRandgen().choose(0, origSize); labeledInstances.add((Instance) dataSet.instance(index).copy()); indexes.add(index); } if (dataSet instanceof WekaDataset) { setLabeledData(new WekaDataset(labeledInstances)); } if (dataSet instanceof MulanDataset) { setLabeledData(new MulanDataset(labeledInstances, ((MulanDataset) dataSet).getLabelsMetaData())); } ArrayList<Container> indexesArray = new ArrayList<Container>(); for (Integer i : indexes) { indexesArray.add(new Container(i, i)); } //The array is ordered in descendent order OrderUtils.mergeSort(indexesArray, true); //Copy the entire dataset into unlabeled set Instances unlabeledInstances = new Instances(dataSet.getDataset()); //remove the instances that have been selected previously for (Container pair : indexesArray) { unlabeledInstances.remove(Integer.parseInt(pair.getValue().toString())); } if (dataSet instanceof WekaDataset) { setUnlabeledData(new WekaDataset(unlabeledInstances)); } if (dataSet instanceof MulanDataset) { setUnlabeledData(new MulanDataset(unlabeledInstances, ((MulanDataset) dataSet).getLabelsMetaData())); } // clean up unlabeledInstances.clear(); labeledInstances.clear(); unlabeledInstances = null; labeledInstances = null; indexes.clear(); indexesArray.clear(); indexes = null; indexesArray = null; }
From source file:org.agnitas.beans.impl.MailingImpl.java
public Vector<String> scanForComponents(ApplicationContext con) throws Exception { Vector<String> addedTags = new Vector<String>(); MailingComponent tmpComp = null;//from w w w . ja va 2s . c o m DynamicTag dyntag = null; DynamicTagContent dyncontent = null; searchPos = 0; Set<MailingComponent> componentsToAdd = new HashSet<MailingComponent>(); Iterator<MailingComponent> itComponents = this.components.values().iterator(); while (itComponents.hasNext()) { tmpComp = itComponents.next(); if (tmpComp.getType() == MailingComponent.TYPE_TEMPLATE) { addedTags.addAll(this.scanForComponents(tmpComp.getEmmBlock(), con, componentsToAdd)); } } addComponents(componentsToAdd); componentsToAdd.clear(); Iterator<DynamicTag> itDynTag = this.dynTags.values().iterator(); while (itDynTag.hasNext()) { dyntag = (DynamicTag) itDynTag.next(); Iterator<DynamicTagContent> it2 = dyntag.getDynContent().values().iterator(); while (it2.hasNext()) { dyncontent = it2.next(); addedTags.addAll(this.scanForComponents(dyncontent.getDynContent(), con, componentsToAdd)); } } addComponents(componentsToAdd); return addedTags; }
From source file:org.apache.hadoop.hive.ql.lockmgr.zookeeper.ZooKeeperHiveLockManager.java
private ZooKeeperHiveLock lock(HiveLockObject key, HiveLockMode mode, boolean keepAlive, boolean parentCreated) throws LockException { LOG.info("Acquiring lock for " + key.getName() + " with mode " + key.getData().getLockMode()); int tryNum = 0; ZooKeeperHiveLock ret = null;//from www. ja v a 2s . c om Set<String> conflictingLocks = new HashSet<String>(); do { tryNum++; try { if (tryNum > 1) { Thread.sleep(sleepTime); prepareRetry(); } ret = lockPrimitive(key, mode, keepAlive, parentCreated, conflictingLocks); if (ret != null) { break; } } catch (Exception e1) { if (e1 instanceof KeeperException) { KeeperException e = (KeeperException) e1; switch (e.code()) { case CONNECTIONLOSS: case OPERATIONTIMEOUT: LOG.debug("Possibly transient ZooKeeper exception: ", e); continue; default: LOG.error("Serious Zookeeper exception: ", e); break; } } if (tryNum >= numRetriesForLock) { console.printError("Unable to acquire " + key.getData().getLockMode() + ", " + mode + " lock " + key.getDisplayName() + " after " + tryNum + " attempts."); LOG.error("Exceeds maximum retries with errors: ", e1); printConflictingLocks(key, mode, conflictingLocks); conflictingLocks.clear(); throw new LockException(e1); } } } while (tryNum < numRetriesForLock); if (ret == null) { console.printError("Unable to acquire " + key.getData().getLockMode() + ", " + mode + " lock " + key.getDisplayName() + " after " + tryNum + " attempts."); printConflictingLocks(key, mode, conflictingLocks); } conflictingLocks.clear(); return ret; }
From source file:org.apache.syncope.client.enduser.resources.UserSelfUpdateResource.java
@Override protected ResourceResponse newResourceResponse(final IResource.Attributes attributes) { ResourceResponse response = new AbstractResource.ResourceResponse(); response.setContentType(MediaType.TEXT_PLAIN); try {//from w w w .j a v a 2s. co m HttpServletRequest request = (HttpServletRequest) attributes.getRequest().getContainerRequest(); if (!xsrfCheck(request)) { LOG.error("XSRF TOKEN does not match"); response.setError(Response.Status.BAD_REQUEST.getStatusCode(), "XSRF TOKEN does not match"); return response; } if (!captchaCheck(request.getHeader("captcha"), request.getSession().getAttribute(SyncopeEnduserConstants.CAPTCHA_SESSION_KEY))) { throw new IllegalArgumentException("Entered captcha is not matching"); } UserTO userTO = MAPPER.readValue(request.getReader().readLine(), UserTO.class); Map<String, CustomAttributesInfo> customForm = SyncopeEnduserApplication.get().getCustomForm(); // check if request is compliant with customization form rules if (UserRequestValidator.compliant(userTO, customForm, false)) { // 1. membership attributes management Set<AttrTO> membAttrs = new HashSet<>(); userTO.getPlainAttrs().stream().filter( attr -> (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))) .forEachOrdered((attr) -> { String[] simpleAttrs = attr.getSchema() .split(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR); MembershipTO membership = userTO.getMemberships().stream() .filter(item -> simpleAttrs[0].equals(item.getGroupName())).findFirst() .orElse(null); if (membership == null) { membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build(); userTO.getMemberships().add(membership); } AttrTO clone = SerializationUtils.clone(attr); clone.setSchema(simpleAttrs[1]); membership.getPlainAttrs().add(clone); membAttrs.add(attr); }); userTO.getPlainAttrs().removeAll(membAttrs); // 2. millis -> Date conversion for PLAIN attributes of USER and its MEMBERSHIPS SyncopeEnduserSession.get().getDatePlainSchemas().stream().map(plainSchema -> { millisToDate(userTO.getPlainAttrs(), plainSchema); return plainSchema; }).forEachOrdered(plainSchema -> { userTO.getMemberships().forEach(membership -> { millisToDate(membership.getPlainAttrs(), plainSchema); }); }); membAttrs.clear(); userTO.getDerAttrs().stream().filter( attr -> (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))) .forEachOrdered(attr -> { String[] simpleAttrs = attr.getSchema() .split(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR); MembershipTO membership = userTO.getMemberships().stream() .filter(item -> simpleAttrs[0].equals(item.getGroupName())).findFirst() .orElse(null); if (membership == null) { membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build(); userTO.getMemberships().add(membership); } AttrTO clone = SerializationUtils.clone(attr); clone.setSchema(simpleAttrs[1]); membership.getDerAttrs().add(clone); membAttrs.add(attr); }); userTO.getDerAttrs().removeAll(membAttrs); membAttrs.clear(); userTO.getVirAttrs().stream().filter( attr -> (attr.getSchema().contains(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR))) .forEachOrdered((attr) -> { String[] simpleAttrs = attr.getSchema() .split(SyncopeEnduserConstants.MEMBERSHIP_ATTR_SEPARATOR); MembershipTO membership = userTO.getMemberships().stream() .filter(item -> simpleAttrs[0].equals(item.getGroupName())).findFirst() .orElse(null); if (membership == null) { membership = new MembershipTO.Builder().group(null, simpleAttrs[0]).build(); userTO.getMemberships().add(membership); } AttrTO clone = SerializationUtils.clone(attr); clone.setSchema(simpleAttrs[1]); membership.getVirAttrs().add(clone); membAttrs.add(attr); }); userTO.getVirAttrs().removeAll(membAttrs); // get old user object from session UserTO selfTO = SyncopeEnduserSession.get().getSelfTO(); // align "userTO" and "selfTO" objects if (customForm != null && !customForm.isEmpty()) { completeUserObject(userTO, selfTO); } // create diff patch UserPatch userPatch = AnyOperations.diff(userTO, selfTO, false); // update user by patch Response res = SyncopeEnduserSession.get().getService(userTO.getETagValue(), UserSelfService.class) .update(userPatch); buildResponse(response, res.getStatus(), res.getStatusInfo().getFamily().equals(Response.Status.Family.SUCCESSFUL) ? "User [" + userTO.getUsername() + "] successfully updated" : "ErrorMessage{{ " + res.getStatusInfo().getReasonPhrase() + " }}"); } else { LOG.warn("Incoming update request [{}] is not compliant with form customization rules." + " Update NOT allowed", userTO.getUsername()); buildResponse(response, Response.Status.OK.getStatusCode(), "User: " + userTO.getUsername() + " successfully created"); } } catch (final Exception e) { LOG.error("Error while updating user", e); response.setError(Response.Status.BAD_REQUEST.getStatusCode(), new StringBuilder().append("ErrorMessage{{ ").append(e.getMessage()).append(" }}").toString()); } return response; }
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.Set.size()'. * * @see java.util.Set#size()// w ww . ja v a2s.com */ public void testSize() { Set<E> set = createSet(); // Test size behavior on add set.add(getKeys()[0]); assertEquals(1, set.size()); set.add(getKeys()[1]); assertEquals(2, set.size()); set.add(getKeys()[2]); assertEquals(3, set.size()); // Test size behavior on remove set.remove(getKeys()[0]); assertEquals(2, set.size()); set.remove(getKeys()[1]); assertEquals(1, set.size()); set.remove(getKeys()[2]); assertEquals(0, set.size()); // Test size behavior on putAll set.add(getKeys()[0]); set.add(getKeys()[1]); set.add(getKeys()[2]); assertEquals(3, set.size()); // Test size behavior on clear set.clear(); _assertEmpty(set); }
From source file:com.github.helenusdriver.driver.impl.PersistedMap.java
/** * {@inheritDoc}/* w w w .j a va 2 s. c om*/ * * @author paouelle * * @see java.util.Map#entrySet() */ @Override public Set<Map.Entry<K, T>> entrySet() { if (eset == null) { final Set<Map.Entry<K, PersistedValue<T, PT>>> eset = map.entrySet(); this.eset = new AbstractSet<Map.Entry<K, T>>() { @Override public int size() { return eset.size(); } @Override public boolean isEmpty() { return eset.isEmpty(); } @Override public Iterator<Map.Entry<K, T>> iterator() { return new TransformIterator<Map.Entry<K, PersistedValue<T, PT>>, Map.Entry<K, T>>( eset.iterator()) { @Override protected Map.Entry<K, T> transform(Map.Entry<K, PersistedValue<T, PT>> me) { return new Entry(me); } }; } @Override public Stream<Map.Entry<K, T>> stream() { return eset.stream().map(me -> new Entry(me)); } @Override public Stream<Map.Entry<K, T>> parallelStream() { return eset.parallelStream().map(me -> new Entry(me)); } @Override public boolean remove(Object o) { if (!(o instanceof Map.Entry)) { return false; } @SuppressWarnings("unchecked") final Map.Entry<K, T> me = (Map.Entry<K, T>) o; return (map.remove(me.getKey()) != null); } @Override public void clear() { eset.clear(); } @Override public String toString() { return eset.toString(); } }; } return eset; }