Tabnine Logo
Map$Entry.setValue
Code IndexAdd Tabnine to your IDE (free)

How to use
setValue
method
in
java.util.Map$Entry

Best Java code snippets using java.util.Map$Entry.setValue (Showing top 20 results out of 11,277)

Refine searchRefine arrow

  • Map.entrySet
  • Map.Entry.getValue
  • Map.Entry.getKey
  • Iterator.next
  • Iterator.hasNext
  • Set.iterator
  • Map.put
  • Map.get
origin: jenkinsci/jenkins

private Map<AbstractProject, List<DependencyGroup>> finalize(Map<AbstractProject, List<DependencyGroup>> m) {
  for (Entry<AbstractProject, List<DependencyGroup>> e : m.entrySet()) {
    Collections.sort( e.getValue(), NAME_COMPARATOR );
    e.setValue( Collections.unmodifiableList(e.getValue()) );
  }
  return Collections.unmodifiableMap(m);
}
origin: spring-projects/spring-framework

private void recreateCaches() {
  for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) {
    entry.setValue(createConcurrentMapCache(entry.getKey()));
  }
}
origin: spring-projects/spring-framework

/**
 * Create the known caches again with the current state of this manager.
 */
private void refreshKnownCaches() {
  for (Map.Entry<String, Cache> entry : this.cacheMap.entrySet()) {
    entry.setValue(createCaffeineCache(entry.getKey()));
  }
}
origin: google/guava

public void testEntrySetSetValueSameValue() {
 // TODO: Investigate the extent to which, in practice, maps that support
 // put() also support Entry.setValue().
 if (!supportsPut) {
  return;
 }
 final Map<K, V> map;
 try {
  map = makePopulatedMap();
 } catch (UnsupportedOperationException e) {
  return;
 }
 Set<Entry<K, V>> entrySet = map.entrySet();
 Entry<K, V> entry = entrySet.iterator().next();
 final V oldValue = entry.getValue();
 final V returnedValue = entry.setValue(oldValue);
 assertEquals(oldValue, returnedValue);
 assertTrue(entrySet.contains(mapEntry(entry.getKey(), oldValue)));
 assertEquals(oldValue, map.get(entry.getKey()));
 assertInvariants(map);
}
origin: hankcs/HanLP

  /**
   * 分割Map,其中旧map直接被改变
   * @param src
   * @param rate
   * @return
   */
  public static Map<String, String[]> splitMap(Map<String, String[]> src, double rate)
  {
    assert 0 <= rate && rate <= 1;
    Map<String, String[]> output = new TreeMap<String, String[]>();
    for (Map.Entry<String, String[]> entry : src.entrySet())
    {
      String[][] array = spiltArray(entry.getValue(), rate);
      output.put(entry.getKey(), array[0]);
      entry.setValue(array[1]);
    }

    return output;
  }
}
origin: spring-projects/spring-framework

  throw new IllegalArgumentException("OUT/INOUT parameter not available: " + key);
Object value = this.outputParameters.get(key);
if (value instanceof IllegalArgumentException) {
  throw (IllegalArgumentException) value;
  this.outputParameters = new LinkedHashMap<>();
this.outputParameters.put(args[0], null);
  for (Map.Entry<Object, Object> entry : this.outputParameters.entrySet()) {
    try {
      Object key = entry.getKey();
      if (key instanceof Integer) {
        entry.setValue(storedProc.getOutputParameterValue((Integer) key));
        entry.setValue(storedProc.getOutputParameterValue(key.toString()));
      entry.setValue(ex);
origin: pxb1988/dex2jar

static <T> void fixReplace(Map<Local, T> toReplace) {
  List<Map.Entry<Local, T>> set = new ArrayList<>(toReplace.entrySet());
  Collections.sort(set, new Comparator<Map.Entry<Local, T>>() {
    @Override
    public int compare(Map.Entry<Local, T> localTEntry, Map.Entry<Local, T> t1) {
      return Integer.compare(localTEntry.getKey()._ls_index, t1.getKey()._ls_index);
    }
  });
  boolean changed = true;
  while (changed) {
    changed = false;
    for (Map.Entry<Local, T> e : set) {
      T b = e.getValue();
      if(b instanceof  Local) {
        T n = toReplace.get(b);
        if (n != null && b != n) {
          changed = true;
          e.setValue(n);
        }
      }
    }
  }
}
origin: org.freemarker/freemarker

  @Override
  public Map getParameterMap() {
    HashMap clone = (HashMap) paramsMap.clone();
    for (Iterator it = clone.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry entry = (Map.Entry) it.next();
      entry.setValue(((String[]) entry.getValue()).clone());
    }
    return Collections.unmodifiableMap(clone);
  }
}
origin: wildfly/wildfly

if(map == null)
  return;
for(Map.Entry<Address,View> entry: map.entrySet()) {
  Address key=entry.getKey();
  List<Address> members=new ArrayList<>(entry.getValue().getMembers());
  boolean modified=false;
  for(Iterator<Address> it=members.iterator(); it.hasNext();) {
    Address val=it.next();
    if(val.equals(key)) // we can always talk to ourself !
      continue;
    View view=map.get(val);
    final Collection<Address> tmp_mbrs=view != null? view.getMembers() : null;
    if(tmp_mbrs != null && !tmp_mbrs.contains(key)) {
    View old_view=entry.getValue();
    entry.setValue(new View(old_view.getViewId(), members));
origin: apache/flink

    if (cm.containsKey(key)) {
      if (!filteredMappings.contains(key) && cm.get(key) == null) {
        filteredMappings.add(key);
        resultMapping.put(key, cm.get(key));
          && !cm.get(key).equals(resultMapping.get(key))) {
        filteredMappings.add(key);
        resultMapping.remove(key);
Iterator<Map.Entry<String, TaggedValue>> it = resultMapping.entrySet().iterator();
while (it.hasNext()) {
  Map.Entry<String, TaggedValue> entry = it.next();
  TaggedValue value = mergeReturnValues(Collections.singletonList(entry.getValue()));
  if (value == null) {
    it.remove();
    entry.setValue(value);
origin: google/guava

public void testBiMapEntrySetIteratorRemove() {
 BiMap<Integer, String> map = HashBiMap.create();
 map.put(1, "one");
 Set<Entry<Integer, String>> entries = map.entrySet();
 Iterator<Entry<Integer, String>> iterator = entries.iterator();
 Entry<Integer, String> entry = iterator.next();
 entry.setValue("two"); // changes the iterator's current entry value
 assertEquals("two", map.get(1));
 assertEquals(Integer.valueOf(1), map.inverse().get("two"));
 iterator.remove(); // removes the updated entry
 assertTrue(map.isEmpty());
}
origin: wildfly/wildfly

public <C> CommandDispatcher<C> createCommandDispatcher(Object id, C context) {
  synchronized (this.dispatchers) {
    Map.Entry<CommandDispatcher<?>, Integer> existingEntry = this.dispatchers.get(id);
    if (existingEntry == null) {
      CommandDispatcher<C> dispatcher = this.factory.createCommandDispatcher(id, context);
      CommandDispatcher<C> result = new ManagedCommandDispatcher<>(dispatcher, () -> {
        synchronized (this.dispatchers) {
          Map.Entry<CommandDispatcher<?>, Integer> entry = this.dispatchers.get(id);
          synchronized (entry) {
            int refs = entry.getValue() - 1;
              this.dispatchers.remove(id);
            } else {
              entry.setValue(refs);
      this.dispatchers.put(id, new AbstractMap.SimpleEntry<>(result, 1));
      return result;
    CommandDispatcher<C> result = (CommandDispatcher<C>) existingEntry.getKey();
      int refs = existingEntry.getValue() + 1;
      existingEntry.setValue(refs);
origin: apache/hbase

private static void addCellPermissions(final byte[] perms, Map<byte[], List<Cell>> familyMap) {
 // Iterate over the entries in the familyMap, replacing the cells therein
 // with new cells including the ACL data
 for (Map.Entry<byte[], List<Cell>> e: familyMap.entrySet()) {
  List<Cell> newCells = Lists.newArrayList();
  for (Cell cell: e.getValue()) {
   // Prepend the supplied perms in a new ACL tag to an update list of tags for the cell
   List<Tag> tags = new ArrayList<>();
   tags.add(new ArrayBackedTag(AccessControlLists.ACL_TAG_TYPE, perms));
   Iterator<Tag> tagIterator = PrivateCellUtil.tagsIterator(cell);
   while (tagIterator.hasNext()) {
    tags.add(tagIterator.next());
   }
   newCells.add(PrivateCellUtil.createCell(cell, tags));
  }
  // This is supposed to be safe, won't CME
  e.setValue(newCells);
 }
}
origin: ben-manes/caffeine

@CheckNoWriter @CheckNoStats
@Test(dataProvider = "caches", expectedExceptions = NullPointerException.class)
@CacheSpec(implementation = Implementation.Caffeine,
  population = { Population.SINGLETON, Population.PARTIAL, Population.FULL })
public void writeThroughEntry_null(Map<Integer, Integer> map, CacheContext context) {
 map.entrySet().iterator().next().setValue(null);
}
origin: commons-collections/commons-collections

    entry1.setValue(newValue1);
  } catch (UnsupportedOperationException ex) {
entry1.setValue(newValue1);
entryConfirmed1.setValue(newValue1);
entry2.setValue(newValue2);
entryConfirmed2.setValue(newValue2);
  entry2.setValue(newValue1);  // should remove key1
} catch (IllegalArgumentException ex) {
  return;  // simplest way of dealing with tricky situation
entryConfirmed2.setValue(newValue1);
AbstractTestBidiMap.this.confirmed.remove(key1);
assertEquals(newValue1, entry2.getValue());
assertEquals(true, AbstractTestBidiMap.this.map.containsKey(entry2.getKey()));
assertEquals(true, AbstractTestBidiMap.this.map.containsValue(newValue1));
assertEquals(newValue1, AbstractTestBidiMap.this.map.get(entry2.getKey()));
assertEquals(false, AbstractTestBidiMap.this.map.containsKey(key1));
assertEquals(false, AbstractTestBidiMap.this.map.containsValue(newValue2));
it.next();  // if you fail here, maybe you should be throwing an IAE, see above
if (isRemoveSupported()) {
  it.remove();
origin: google/guava

public void testLinkedEntries() {
 Multimap<String, Integer> map = create();
 map.put("bar", 1);
 map.put("foo", 2);
 map.put("bar", 3);
 Iterator<Entry<String, Integer>> entries = map.entries().iterator();
 Entry<String, Integer> entry = entries.next();
 assertEquals("bar", entry.getKey());
 assertEquals(1, (int) entry.getValue());
 entry = entries.next();
 assertEquals("foo", entry.getKey());
 assertEquals(2, (int) entry.getValue());
 entry.setValue(4);
 entry = entries.next();
 assertEquals("bar", entry.getKey());
 assertEquals(3, (int) entry.getValue());
 assertFalse(entries.hasNext());
 entries.remove();
 assertEquals("{bar=[1], foo=[4]}", map.toString());
}
origin: code4craft/webmagic

private void handleObject(Iterator<Map.Entry<String, Object>> iterator) {
  Map.Entry<String, Object> objectEntry = iterator.next();
  Object o = objectEntry.getValue();
      for (Map.Entry<String, Boolean> stringBooleanEntry : booleanMap.entrySet()) {
        if (!stringBooleanEntry.getValue()) {
          iterator.remove();
          return;
      entryList.addAll(objectMap.get(multiPageModel.getPageKey()).entrySet());
      if (entryList.size() != 0) {
        Collections.sort(entryList, new Comparator<Map.Entry<String, MultiPageModel>>() {
        MultiPageModel value = entryList.get(0).getValue();
        for (int i = 1; i < entryList.size(); i++) {
          value = value.combine(entryList.get(i).getValue());
        objectEntry.setValue(value);
origin: commons-collections/commons-collections

/**
 * Tests the constructors.
 */
public void testSetValue() {
  Map map = new HashMap();
  map.put("A", "a");
  map.put("B", "b");
  map.put("C", "c");
  Map.Entry entry = new TiedMapEntry(map, "A");
  assertSame("A", entry.getKey());
  assertSame("a", entry.getValue());
  assertSame("a", entry.setValue("x"));
  assertSame("A", entry.getKey());
  assertSame("x", entry.getValue());
  
  entry = new TiedMapEntry(map, "B");
  assertSame("B", entry.getKey());
  assertSame("b", entry.getValue());
  assertSame("b", entry.setValue("y"));
  assertSame("B", entry.getKey());
  assertSame("y", entry.getValue());
  
  entry = new TiedMapEntry(map, "C");
  assertSame("C", entry.getKey());
  assertSame("c", entry.getValue());
  assertSame("c", entry.setValue("z"));
  assertSame("C", entry.getKey());
  assertSame("z", entry.getValue());
}
origin: commons-collections/commons-collections

    entry1.setValue(newValue1);
  } catch (UnsupportedOperationException ex) {
entry1.setValue(newValue1);
entryConfirmed1.setValue(newValue1);
assertEquals(newValue1, entry1.getValue());
assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
verify();
entry1.setValue(newValue1);
entryConfirmed1.setValue(newValue1);
assertEquals(newValue1, entry1.getValue());
assertEquals(true, AbstractTestMap.this.map.containsKey(entry1.getKey()));
assertEquals(true, AbstractTestMap.this.map.containsValue(newValue1));
assertEquals(newValue1, AbstractTestMap.this.map.get(entry1.getKey()));
verify();
entry2.setValue(newValue2);
entryConfirmed2.setValue(newValue2);
assertEquals(newValue2, entry2.getValue());
assertEquals(true, AbstractTestMap.this.map.containsKey(entry2.getKey()));
assertEquals(true, AbstractTestMap.this.map.containsValue(newValue2));
assertEquals(newValue2, AbstractTestMap.this.map.get(entry2.getKey()));
verify();
origin: google/guava

public void testEntrySetToTypedArrayMutationThrows() {
 map.putInstance(String.class, "test");
 @SuppressWarnings("unchecked") // Should get a CCE later if cast is wrong
 Entry<Object, Object> entry = map.entrySet().toArray(new Entry[0])[0];
 assertEquals(TypeToken.of(String.class), entry.getKey());
 assertEquals("test", entry.getValue());
 try {
  entry.setValue(1);
  fail();
 } catch (UnsupportedOperationException expected) {
 }
}
java.utilMap$EntrysetValue

Javadoc

Sets the value of this entry to the specified value, replacing any existing value.

Popular methods of Map$Entry

  • getValue
    Returns the value corresponding to this entry. If the mapping has been removed from the backing map
  • getKey
  • equals
    Compares the specified object to this Map.Entry and returns if they are equal. To be equal, the obje
  • hashCode
    Returns an integer hash code for the receiver. Object which are equal return the same value for this
  • comparingByValue
  • comparingByKey
  • <init>

Popular in Java

  • Reactive rest calls using spring rest template
  • onRequestPermissionsResult (Fragment)
  • putExtra (Intent)
  • setScale (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now