Ignore:
Timestamp:
2016-07-23T02:08:50+02:00 (4 years ago)
Author:
Don-vip
Message:

see #11390 - sonar - squid:S1610 - Java 8: Abstract classes without fields should be converted to interfaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java

    r10552 r10599  
    318318     *
    319319     * @since 8954
    320      */
    321     public abstract static class Strategy {
     320     * @since 10599 (functional interface)
     321     */
     322    @FunctionalInterface
     323    public interface Strategy {
    322324
    323325        /**
     
    327329         * @return the way to keep
    328330         */
    329         public abstract Way determineWayToKeep(Iterable<Way> wayChunks);
     331        Way determineWayToKeep(Iterable<Way> wayChunks);
    330332
    331333        /**
     
    333335         * @return strategy which selects the way chunk with the highest node count to keep
    334336         */
    335         public static Strategy keepLongestChunk() {
    336             return new Strategy() {
    337                 @Override
    338                 public Way determineWayToKeep(Iterable<Way> wayChunks) {
     337        static Strategy keepLongestChunk() {
     338            return wayChunks -> {
    339339                    Way wayToKeep = null;
    340340                    for (Way i : wayChunks) {
     
    344344                    }
    345345                    return wayToKeep;
    346                 }
    347             };
     346                };
    348347        }
    349348
     
    352351         * @return strategy which selects the first way chunk
    353352         */
    354         public static Strategy keepFirstChunk() {
    355             return new Strategy() {
    356                 @Override
    357                 public Way determineWayToKeep(Iterable<Way> wayChunks) {
    358                     return wayChunks.iterator().next();
    359                 }
    360             };
     353        static Strategy keepFirstChunk() {
     354            return wayChunks -> wayChunks.iterator().next();
    361355        }
    362356    }
Note: See TracChangeset for help on using the changeset viewer.