@Test public void testPut() { ProjectRef key = SimpleProjectRef.parse( "foo:bar" ); map.put(key, "value"); Assert.assertTrue( "Should have retrieved value", map.containsKey( key)); }
public void put(ProjectRef key, T value) { String groupId = key.getGroupId(); String artifactId = key.getArtifactId(); LinkedHashMap<String,T> vMap = map.get(groupId); if ( vMap == null) { vMap = new LinkedHashMap<>(); } boolean wildcard = false; if ( WILDCARD.equals(artifactId)) { if (!vMap.isEmpty()) { logger.warn ("Emptying map with keys " + vMap.keySet() + " as replacing with wildcard mapping " + key); } vMap.clear(); } else { for ( Object o : vMap.keySet() ) { if ( o.equals( WILDCARD ) ) { wildcard = true; break; } } } if ( wildcard ) { logger.warn ("Unable to add " + key + " with value " + value + " as wildcard mapping for " + groupId + " already exists."); } else { vMap.put(artifactId, value); map.put(groupId, vMap); } }
WildcardMap { public void put(ProjectRef key, T value) { String groupId = key.getGroupId(); String artifactId = key.getArtifactId(); LinkedHashMap<String,T> vMap = map.get(groupId); if ( vMap == null) { vMap = new LinkedHashMap<>(); } boolean wildcard = false; if ( WILDCARD.equals(artifactId)) { if (!vMap.isEmpty()) { logger.warn ("Emptying map with keys " + vMap.keySet() + " as replacing with wildcard mapping " + key); } vMap.clear(); } else { for ( Object o : vMap.keySet() ) { if ( o.equals( WILDCARD ) ) { wildcard = true; break; } } } if ( wildcard ) { logger.warn ("Unable to add " + key + " with value " + value + " as wildcard mapping for " + groupId + " already exists."); } else { vMap.put(artifactId, value); map.put(groupId, vMap); } } }
WildcardMap { public void put(ProjectRef key, T value) { String groupId = key.getGroupId(); String artifactId = key.getArtifactId(); LinkedHashMap<String,T> vMap = map.get(groupId); if ( vMap == null) { vMap = new LinkedHashMap<>(); } boolean wildcard = false; if ( WILDCARD.equals(artifactId)) { if (!vMap.isEmpty()) { logger.warn ("Emptying map with keys " + vMap.keySet() + " as replacing with wildcard mapping " + key); } vMap.clear(); } else { for ( Object o : vMap.keySet() ) { if ( o.equals( WILDCARD ) ) { wildcard = true; break; } } } if ( wildcard ) { logger.warn ("Unable to add " + key + " with value " + value + " as wildcard mapping for " + groupId + " already exists."); } else { vMap.put(artifactId, value); map.put(groupId, vMap); } }  }
WildcardMap { public void put(ProjectRef key, T value) { String groupId = key.getGroupId(); String artifactId = key.getArtifactId(); LinkedHashMap<String,T> vMap = map.get(groupId); if ( vMap == null) { vMap = new LinkedHashMap<>(); } boolean wildcard = false; if ( WILDCARD.equals(artifactId)) { if (!vMap.isEmpty()) { logger.warn ("Emptying map with keys " + vMap.keySet() + " as replacing with wildcard mapping " + key); } vMap.clear(); } else { for ( Object o : vMap.keySet() ) { if ( o.equals( WILDCARD ) ) { wildcard = true; break; } } } if ( wildcard ) { logger.warn ("Unable to add " + key + " with value " + value + " as wildcard mapping for " + groupId + " already exists."); } else { vMap.put(artifactId, value); map.put(groupId, vMap); } }  int size(); boolean containsKey(Dependency key); boolean containsKey(ProjectRef key); void put(ProjectRef key, T value); T get(Dependency key); T get(ProjectRef key); boolean isEmpty(); @Override String toString(); }
WildcardMap { public void put(ProjectRef key, T value) { String groupId = key.getGroupId(); String artifactId = key.getArtifactId(); LinkedHashMap<String,T> vMap = map.get(groupId); if ( vMap == null) { vMap = new LinkedHashMap<>(); } boolean wildcard = false; if ( WILDCARD.equals(artifactId)) { if (!vMap.isEmpty()) { logger.warn ("Emptying map with keys " + vMap.keySet() + " as replacing with wildcard mapping " + key); } vMap.clear(); } else { for ( Object o : vMap.keySet() ) { if ( o.equals( WILDCARD ) ) { wildcard = true; break; } } } if ( wildcard ) { logger.warn ("Unable to add " + key + " with value " + value + " as wildcard mapping for " + groupId + " already exists."); } else { vMap.put(artifactId, value); map.put(groupId, vMap); } }  int size(); boolean containsKey(Dependency key); boolean containsKey(ProjectRef key); void put(ProjectRef key, T value); T get(Dependency key); T get(ProjectRef key); boolean isEmpty(); @Override String toString(); static final String WILDCARD; }