Changeset 10717 in josm
- Timestamp:
- 2016-08-03T15:39:00+02:00 (8 years ago)
- Location:
- trunk
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10716 r10717 250 250 251 251 private static boolean isTagged(final Collection<Node> existingNodes) { 252 return existingNodes.stream().anyMatch( selectedNode -> selectedNode.hasKeys());252 return existingNodes.stream().anyMatch(Node::hasKeys); 253 253 } 254 254 -
trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
r10657 r10717 59 59 public void setPrimitives(Collection<? extends OsmPrimitive> primitives) { 60 60 // selected relations with incomplete members 61 this.relations = SubclassFilteredCollection.filter(getRelations(primitives), r -> r.hasIncompleteMembers());61 this.relations = SubclassFilteredCollection.filter(getRelations(primitives), Relation::hasIncompleteMembers); 62 62 this.incompleteMembers = buildSetOfIncompleteMembers(relations); 63 63 updateEnabledState(); -
trunk/src/org/openstreetmap/josm/data/osm/NoteData.java
r10657 r10717 153 153 } else { 154 154 final Note existingNote = noteList.get(newNote); 155 final boolean isDirty = existingNote.getComments().stream().anyMatch( object -> object.isNew());155 final boolean isDirty = existingNote.getComments().stream().anyMatch(NoteComment::isNew); 156 156 if (!isDirty) { 157 157 noteList.put(newNote); -
trunk/src/org/openstreetmap/josm/data/osm/Relation.java
r10716 r10717 401 401 402 402 public List<OsmPrimitive> getMemberPrimitivesList() { 403 return Utils.transform(getMembers(), (Function<RelationMember, OsmPrimitive>) x -> x.getMember());403 return Utils.transform(getMembers(), RelationMember::getMember); 404 404 } 405 405 -
trunk/src/org/openstreetmap/josm/gui/conflict/tags/RelationMemberConflictResolverModel.java
r10716 r10717 234 234 iterators.add(i.iterator()); 235 235 } 236 while (iterators.stream().allMatch( it -> it.hasNext())) {236 while (iterators.stream().allMatch(Iterator::hasNext)) { 237 237 final List<RelationMemberConflictDecision> decisions = new ArrayList<>(); 238 238 final Collection<String> roles = new HashSet<>(); -
trunk/src/org/openstreetmap/josm/gui/dialogs/OsmIdSelectionDialog.java
r10680 r10717 206 206 .collect(Collectors.joining(", ")); 207 207 tfId.tryToPasteFrom(parsedText); 208 final Set<OsmPrimitiveType> types = ids.stream().map( x -> x.getType()).collect(Collectors.toSet());208 final Set<OsmPrimitiveType> types = ids.stream().map(SimplePrimitiveId::getType).collect(Collectors.toSet()); 209 209 if (types.size() == 1) { 210 210 // select corresponding type -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r10638 r10717 300 300 @Override 301 301 public void actionPerformed(ActionEvent arg0) { 302 final List<PrimitiveId> primitiveIds = model.getSelectedPrimitives().stream().map( x -> x.getPrimitiveId())302 final List<PrimitiveId> primitiveIds = model.getSelectedPrimitives().stream().map(HistoryOsmPrimitive::getPrimitiveId) 303 303 .collect(Collectors.toList()); 304 304 Main.worker.submit(new DownloadPrimitivesWithReferrersTask(false, primitiveIds, true, true, null, null)); -
trunk/src/org/openstreetmap/josm/gui/layer/LayerPositionStrategy.java
r10715 r10717 37 37 */ 38 38 LayerPositionStrategy BEFORE_FIRST_BACKGROUND_LAYER = inFrontOfFirst( 39 layer -> layer.isBackgroundLayer());39 Layer::isBackgroundLayer); 40 40 41 41 /** -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/Condition.java
r10715 r10717 166 166 ONE_OF((test, prototype) -> Arrays.asList(test.split("\\s*;\\s*")).contains(prototype)), 167 167 /** The value needs to begin with the reference string. */ 168 BEGINS_WITH( (test, prototype) -> test.startsWith(prototype)),168 BEGINS_WITH(String::startsWith), 169 169 /** The value needs to end with the reference string. */ 170 ENDS_WITH( (test, prototype) -> test.endsWith(prototype)),170 ENDS_WITH(String::endsWith), 171 171 /** The value needs to contain the reference string. */ 172 CONTAINS( (test, prototype) -> test.contains(prototype));172 CONTAINS(String::contains); 173 173 174 174 static final Set<Op> NEGATED_OPS = EnumSet.of(NEQ, NREGEX); -
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r10670 r10717 234 234 235 235 formats = getChildrenStream(child, "Format") 236 .map( x -> x.getTextContent())236 .map(Node::getTextContent) 237 237 .filter(WMSImagery::isImageFormatSupportedWarn) 238 238 .collect(Collectors.toList()); -
trunk/src/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandler.java
r10689 r10717 132 132 public String[] getUsageExamples() { 133 133 final String types = Utils.join("|", Utils.transform(Arrays.asList(ImageryInfo.ImageryType.values()), 134 (Function<ImageryType, String>) x -> x.getTypeString()));134 ImageryType::getTypeString)); 135 135 return new String[] { 136 136 "/imagery?title=osm&type=tms&url=https://a.tile.openstreetmap.org/%7Bzoom%7D/%7Bx%7D/%7By%7D.png", -
trunk/src/org/openstreetmap/josm/tools/ExceptionUtil.java
r10689 r10717 16 16 import java.util.Date; 17 17 import java.util.TreeSet; 18 import java.util.function.Function;19 18 import java.util.regex.Matcher; 20 19 import java.util.regex.Pattern; … … 142 141 OsmPrimitive firstRefs = conflict.b.iterator().next(); 143 142 String objId = Long.toString(conflict.a.getId()); 144 Collection<Long> refIds = Utils.transform(conflict.b, (Function<OsmPrimitive, Long>) x -> x.getId());143 Collection<Long> refIds = Utils.transform(conflict.b, OsmPrimitive::getId); 145 144 String refIdsString = refIds.size() == 1 ? refIds.iterator().next().toString() : refIds.toString(); 146 145 if (conflict.a instanceof Node) { -
trunk/src/org/openstreetmap/josm/tools/MemoryManager.java
r10598 r10717 87 87 */ 88 88 public synchronized long getAvailableMemory() { 89 return getMaxMemory() - activeHandles.stream().mapToLong( h -> h.getSize()).sum();89 return getMaxMemory() - activeHandles.stream().mapToLong(MemoryHandle::getSize).sum(); 90 90 } 91 91 … … 104 104 protected synchronized List<MemoryHandle<?>> resetState() { 105 105 ArrayList<MemoryHandle<?>> toFree = new ArrayList<>(activeHandles); 106 toFree. stream().forEach(h -> h.free());106 toFree.forEach(MemoryHandle::free); 107 107 return toFree; 108 108 } -
trunk/src/org/openstreetmap/josm/tools/MultiLineFlowLayout.java
r10622 r10717 48 48 @Override 49 49 public Dimension preferredLayoutSize(Container target) { 50 return getLayoutSize(target, c -> c.getPreferredSize());50 return getLayoutSize(target, Component::getPreferredSize); 51 51 } 52 52 53 53 @Override 54 54 public Dimension minimumLayoutSize(Container target) { 55 return getLayoutSize(target, c -> c.getMinimumSize());55 return getLayoutSize(target, Component::getMinimumSize); 56 56 } 57 57 -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r10715 r10717 319 319 */ 320 320 public static String joinAsHtmlUnorderedList(Iterable<?> values) { 321 return StreamUtils.toStream(values.iterator()).map( x -> x.toString()).collect(StreamUtils.toHtmlList());321 return StreamUtils.toStream(values.iterator()).map(Object::toString).collect(StreamUtils.toHtmlList()); 322 322 } 323 323 … … 1341 1341 */ 1342 1342 public static Executor newDirectExecutor() { 1343 return command -> command.run();1343 return Runnable::run; 1344 1344 } 1345 1345 -
trunk/test/unit/org/openstreetmap/josm/io/OsmWriterTest.java
r10638 r10717 32 32 Collections.sort(ids, OsmWriter.byIdComparator); 33 33 34 final long[] longIds = ids.stream().mapToLong( x -> x.getUniqueId()).toArray();34 final long[] longIds = ids.stream().mapToLong(NodeData::getUniqueId).toArray(); 35 35 assertArrayEquals(new long[] { 36 36 -3, -12, -20, -9223372036854775808L, 0, 2, 12, 65, 9223372036854775807L -
trunk/test/unit/org/openstreetmap/josm/tools/MemoryManagerTest.java
r10588 r10717 48 48 assertTrue(testMemory.toString().startsWith("MemoryHandle")); 49 49 50 manager.allocateMemory("test2", 10, () -> new Object());50 manager.allocateMemory("test2", 10, Object::new); 51 51 assertEquals(available - 20, manager.getAvailableMemory()); 52 52 … … 62 62 public void testUseAfterFree() throws NotEnoughMemoryException { 63 63 MemoryManager manager = MemoryManager.getInstance(); 64 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, () -> new Object());64 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 65 65 testMemory.free(); 66 66 testMemory.get(); … … 74 74 public void testFreeAfterFree() throws NotEnoughMemoryException { 75 75 MemoryManager manager = MemoryManager.getInstance(); 76 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, () -> new Object());76 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 77 77 testMemory.free(); 78 78 testMemory.free(); … … 136 136 assertTrue(manager.resetState().isEmpty()); 137 137 138 manager.allocateMemory("test", 10, () -> new Object());139 manager.allocateMemory("test2", 10, () -> new Object());138 manager.allocateMemory("test", 10, Object::new); 139 manager.allocateMemory("test2", 10, Object::new); 140 140 assertEquals(2, manager.resetState().size()); 141 141 … … 150 150 public void testResetStateUseAfterFree() throws NotEnoughMemoryException { 151 151 MemoryManager manager = MemoryManager.getInstance(); 152 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, () -> new Object());152 MemoryHandle<Object> testMemory = manager.allocateMemory("test", 10, Object::new); 153 153 154 154 assertFalse(manager.resetState().isEmpty());
Note:
See TracChangeset
for help on using the changeset viewer.