CompositeKey cKey = new CompositeKey(1,2); Map x.put(cKey,val);
/** * Return all composite keys with the given {@code key} */ private Set<CompositeKey> getCompositeKeys(K key) { Set<CompositeKey> candidateKeys = new HashSet<CompositeKey>(); for (Object keyObj : secondsOfKeys.keySet()) { CompositeKey compositeKey = (CompositeKey) keyObj; if (compositeKey.getKey().equals(key)) { candidateKeys.add(compositeKey); } } return candidateKeys; }
/** * Return all composite keys with the given {@code key} */ private Set<CompositeKey> getCompositeKeys(K key) { Set<CompositeKey> candidateKeys = new HashSet<CompositeKey>(); for (Object keyObj : secondsOfKeys.keySet()) { CompositeKey compositeKey = (CompositeKey) keyObj; if (compositeKey.getKey().equals(key)) { candidateKeys.add(compositeKey); } } return candidateKeys; }
Criterion attdDateCondition = Restrictions.conjunction() .add(Restrictions.idEq("id", new CompositeKey("empId", "lastDate", "startDate"));
Map<CompositeKey, String> map = new HashMap<>(); map.put(new CompositeKey(200, "SLT", 0), "Value 1"); String value = map.get(new CompositeKey(200, "SLT", 0));
private boolean scheduleEntry(long delayMillis, K key, V value) { int delaySeconds = ceilToSecond(delayMillis); Integer newSecond = findRelativeSecond(delayMillis); synchronized (mutex) { long id = uniqueIdGenerator.incrementAndGet(); Object compositeKey = new CompositeKey(key, id); secondsOfKeys.put(compositeKey, newSecond); ScheduledEntry<K, V> scheduledEntry = new ScheduledEntry<K, V>(key, value, delayMillis, delaySeconds, id); doSchedule(compositeKey, scheduledEntry, newSecond); } return true; }
private boolean scheduleEntry(long delayMillis, K key, V value) { int delaySeconds = ceilToSecond(delayMillis); Integer newSecond = findRelativeSecond(delayMillis); synchronized (mutex) { long id = uniqueIdGenerator.incrementAndGet(); Object compositeKey = new CompositeKey(key, id); secondsOfKeys.put(compositeKey, newSecond); ScheduledEntry<K, V> scheduledEntry = new ScheduledEntry<K, V>(key, value, delayMillis, delaySeconds, id); doSchedule(compositeKey, scheduledEntry, newSecond); } return true; }