Replace unnecessary type parameters with <>
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Feb 2019 22:49:12 +0000 (23:49 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Feb 2019 22:49:12 +0000 (23:49 +0100)
44 files changed:
src/main/java/net/pterodactylus/sone/core/ConfigurationSoneParser.java
src/main/java/net/pterodactylus/sone/core/Core.java
src/main/java/net/pterodactylus/sone/core/FreenetInterface.java
src/main/java/net/pterodactylus/sone/core/Preferences.java
src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java
src/main/java/net/pterodactylus/sone/core/SoneInserter.java
src/main/java/net/pterodactylus/sone/core/SoneParser.java
src/main/java/net/pterodactylus/sone/core/WebOfTrustUpdaterImpl.java
src/main/java/net/pterodactylus/sone/data/Album.java
src/main/java/net/pterodactylus/sone/data/Profile.java
src/main/java/net/pterodactylus/sone/data/impl/AlbumImpl.java
src/main/java/net/pterodactylus/sone/data/impl/SoneImpl.java
src/main/java/net/pterodactylus/sone/database/memory/ConfigurationLoader.java
src/main/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabase.java
src/main/java/net/pterodactylus/sone/fcp/FcpInterface.java
src/main/java/net/pterodactylus/sone/fcp/GetPostFeedCommand.java
src/main/java/net/pterodactylus/sone/fcp/GetSonesCommand.java
src/main/java/net/pterodactylus/sone/freenet/L10nFilter.java
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityLoader.java
src/main/java/net/pterodactylus/sone/freenet/wot/IdentityManagerImpl.java
src/main/java/net/pterodactylus/sone/freenet/wot/WebOfTrustConnector.java
src/main/java/net/pterodactylus/sone/main/DebugLoaders.java
src/main/java/net/pterodactylus/sone/notify/ListNotification.java
src/main/java/net/pterodactylus/sone/notify/ListNotificationFilter.java
src/main/java/net/pterodactylus/sone/template/AlbumAccessor.java
src/main/java/net/pterodactylus/sone/template/CollectionAccessor.java
src/main/java/net/pterodactylus/sone/template/FilesystemTemplate.java
src/main/java/net/pterodactylus/sone/template/RequestChangeFilter.java
src/main/java/net/pterodactylus/sone/template/UniqueElementFilter.java
src/main/java/net/pterodactylus/sone/web/WebInterface.java
src/main/java/net/pterodactylus/sone/web/page/PageToadlet.java
src/test/java/net/pterodactylus/sone/core/FreenetInterfaceTest.java
src/test/java/net/pterodactylus/sone/core/SoneInserterTest.java
src/test/java/net/pterodactylus/sone/core/SoneParserTest.java
src/test/java/net/pterodactylus/sone/database/memory/MemoryBookmarkDatabaseTest.java
src/test/java/net/pterodactylus/sone/database/memory/MemoryDatabaseTest.java
src/test/java/net/pterodactylus/sone/freenet/wot/IdentityChangeEventSenderTest.java
src/test/java/net/pterodactylus/sone/notify/ListNotificationTest.java
src/test/java/net/pterodactylus/sone/template/CollectionAccessorTest.java
src/test/java/net/pterodactylus/sone/template/FilesystemTemplateTest.java
src/test/java/net/pterodactylus/sone/template/GetPagePluginTest.java
src/test/java/net/pterodactylus/sone/test/TestAlbumBuilder.java
src/test/java/net/pterodactylus/sone/test/TestValue.java
src/test/java/net/pterodactylus/sone/utils/DefaultOptionTest.java

index aa387e9..99c1c9d 100644 (file)
@@ -33,9 +33,9 @@ public class ConfigurationSoneParser {
        private final Configuration configuration;
        private final Sone sone;
        private final String sonePrefix;
-       private final Map<String, Album> albums = new HashMap<String, Album>();
-       private final List<Album> topLevelAlbums = new ArrayList<Album>();
-       private final Map<String, Image> images = new HashMap<String, Image>();
+       private final Map<String, Album> albums = new HashMap<>();
+       private final List<Album> topLevelAlbums = new ArrayList<>();
+       private final Map<String, Image> images = new HashMap<>();
 
        public ConfigurationSoneParser(Configuration configuration, Sone sone) {
                this.configuration = configuration;
@@ -84,7 +84,7 @@ public class ConfigurationSoneParser {
 
        public Set<Post> parsePosts(PostBuilderFactory postBuilderFactory)
        throws InvalidPostFound {
-               Set<Post> posts = new HashSet<Post>();
+               Set<Post> posts = new HashSet<>();
                while (true) {
                        String postPrefix = "/Posts/" + posts.size();
                        String postId = getString(postPrefix + "/ID", null);
@@ -121,7 +121,7 @@ public class ConfigurationSoneParser {
 
        public Set<PostReply> parsePostReplies(
                        PostReplyBuilderFactory postReplyBuilderFactory) {
-               Set<PostReply> replies = new HashSet<PostReply>();
+               Set<PostReply> replies = new HashSet<>();
                while (true) {
                        String replyPrefix = "/Replies/" + replies.size();
                        String replyId = getString(replyPrefix + "/ID", null);
@@ -147,7 +147,7 @@ public class ConfigurationSoneParser {
        }
 
        public Set<String> parseLikedPostIds() {
-               Set<String> likedPostIds = new HashSet<String>();
+               Set<String> likedPostIds = new HashSet<>();
                while (true) {
                        String likedPostId =
                                        getString("/Likes/Post/" + likedPostIds.size() + "/ID",
@@ -161,7 +161,7 @@ public class ConfigurationSoneParser {
        }
 
        public Set<String> parseLikedPostReplyIds() {
-               Set<String> likedPostReplyIds = new HashSet<String>();
+               Set<String> likedPostReplyIds = new HashSet<>();
                while (true) {
                        String likedReplyId = getString(
                                        "/Likes/Reply/" + likedPostReplyIds.size() + "/ID", null);
@@ -174,7 +174,7 @@ public class ConfigurationSoneParser {
        }
 
        public Set<String> parseFriends() {
-               Set<String> friends = new HashSet<String>();
+               Set<String> friends = new HashSet<>();
                while (true) {
                        String friendId =
                                        getString("/Friends/" + friends.size() + "/ID", null);
index 8e20176..8c05fe4 100644 (file)
@@ -156,18 +156,18 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
 
        /** Locked local Sones. */
        /* synchronize on itself. */
-       private final Set<Sone> lockedSones = new HashSet<Sone>();
+       private final Set<Sone> lockedSones = new HashSet<>();
 
        /** Sone inserters. */
        /* synchronize access on this on sones. */
-       private final Map<Sone, SoneInserter> soneInserters = new HashMap<Sone, SoneInserter>();
+       private final Map<Sone, SoneInserter> soneInserters = new HashMap<>();
 
        /** Sone rescuers. */
        /* synchronize access on this on sones. */
-       private final Map<Sone, SoneRescuer> soneRescuers = new HashMap<Sone, SoneRescuer>();
+       private final Map<Sone, SoneRescuer> soneRescuers = new HashMap<>();
 
        /** All known Sones. */
-       private final Set<String> knownSones = new HashSet<String>();
+       private final Set<String> knownSones = new HashSet<>();
 
        /** The post database. */
        private final Database database;
@@ -176,7 +176,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
        private final Multimap<OwnIdentity, Identity> trustedIdentities = Multimaps.synchronizedSetMultimap(HashMultimap.<OwnIdentity, Identity>create());
 
        /** All temporary images. */
-       private final Map<String, TemporaryImage> temporaryImages = new HashMap<String, TemporaryImage>();
+       private final Map<String, TemporaryImage> temporaryImages = new HashMap<>();
 
        /** Ticker for threads that mark own elements as known. */
        private final ScheduledExecutorService localElementTicker = Executors.newScheduledThreadPool(1);
@@ -444,7 +444,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
         * @return The Sones that like the given post
         */
        public Set<Sone> getLikes(Post post) {
-               Set<Sone> sones = new HashSet<Sone>();
+               Set<Sone> sones = new HashSet<>();
                for (Sone sone : getSones()) {
                        if (sone.getLikedPostIds().contains(post.getId())) {
                                sones.add(sone);
@@ -461,7 +461,7 @@ public class Core extends AbstractService implements SoneProvider, PostProvider,
         * @return The Sones that like the given reply
         */
        public Set<Sone> getLikes(PostReply reply) {
-               Set<Sone> sones = new HashSet<Sone>();
+               Set<Sone> sones = new HashSet<>();
                for (Sone sone : getSones()) {
                        if (sone.getLikedReplyIds().contains(reply.getId())) {
                                sones.add(sone);
index f2cbec6..b2ac0ce 100644 (file)
@@ -96,7 +96,7 @@ public class FreenetInterface {
        private final RequestClient requestClient = new RequestClientBuilder().realTime().build();
 
        /** The USK callbacks. */
-       private final Map<String, USKCallback> soneUskCallbacks = new HashMap<String, USKCallback>();
+       private final Map<String, USKCallback> soneUskCallbacks = new HashMap<>();
 
        /** The not-Sone-related USK callbacks. */
        private final Map<FreenetURI, USKCallback> uriUskCallbacks = Collections.synchronizedMap(new HashMap<FreenetURI, USKCallback>());
index 73d964c..bd3c056 100644 (file)
@@ -44,28 +44,28 @@ public class Preferences {
 
        private final EventBus eventBus;
        private final Option<Integer> insertionDelay =
-                       new DefaultOption<Integer>(60, range(0, MAX_VALUE));
+                       new DefaultOption<>(60, range(0, MAX_VALUE));
        private final Option<Integer> postsPerPage =
-                       new DefaultOption<Integer>(10, range(1, MAX_VALUE));
+                       new DefaultOption<>(10, range(1, MAX_VALUE));
        private final Option<Integer> imagesPerPage =
-                       new DefaultOption<Integer>(9, range(1, MAX_VALUE));
+                       new DefaultOption<>(9, range(1, MAX_VALUE));
        private final Option<Integer> charactersPerPost =
-                       new DefaultOption<Integer>(400, Predicates.<Integer>or(
+                       new DefaultOption<>(400, Predicates.<Integer>or(
                                        range(50, MAX_VALUE), equalTo(-1)));
        private final Option<Integer> postCutOffLength =
-                       new DefaultOption<Integer>(200, range(50, MAX_VALUE));
+                       new DefaultOption<>(200, range(50, MAX_VALUE));
        private final Option<Boolean> requireFullAccess =
-                       new DefaultOption<Boolean>(false);
+                       new DefaultOption<>(false);
        private final Option<Integer> positiveTrust =
-                       new DefaultOption<Integer>(75, range(0, 100));
+                       new DefaultOption<>(75, range(0, 100));
        private final Option<Integer> negativeTrust =
-                       new DefaultOption<Integer>(-25, range(-100, 100));
+                       new DefaultOption<>(-25, range(-100, 100));
        private final Option<String> trustComment =
-                       new DefaultOption<String>("Set from Sone Web Interface");
+                       new DefaultOption<>("Set from Sone Web Interface");
        private final Option<Boolean> activateFcpInterface =
-                       new DefaultOption<Boolean>(false);
+                       new DefaultOption<>(false);
        private final Option<FullAccessRequired> fcpFullAccessRequired =
-                       new DefaultOption<FullAccessRequired>(ALWAYS);
+                       new DefaultOption<>(ALWAYS);
 
        public Preferences(EventBus eventBus) {
                this.eventBus = eventBus;
index 91bf13b..c0d491b 100644 (file)
@@ -62,7 +62,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade
        private final FreenetInterface freenetInterface;
 
        /** The sones to update. */
-       private final Set<Sone> sones = new HashSet<Sone>();
+       private final Set<Sone> sones = new HashSet<>();
 
        @Inject
        SoneDownloaderImpl(UpdatedSoneProcessor updatedSoneProcessor, FreenetInterface freenetInterface, SoneParser soneParser) {
index ba5d0a9..3e1fd15 100644 (file)
@@ -283,7 +283,7 @@ public class SoneInserter extends AbstractService {
        class InsertInformation implements Closeable {
 
                /** All properties of the Sone, copied for thread safety. */
-               private final Map<String, Object> soneProperties = new HashMap<String, Object>();
+               private final Map<String, Object> soneProperties = new HashMap<>();
                private final String fingerprint;
                private final ManifestCreator manifestCreator;
 
@@ -295,7 +295,7 @@ public class SoneInserter extends AbstractService {
                 */
                public InsertInformation(Sone sone) {
                        this.fingerprint = sone.getFingerprint();
-                       Map<String, Object> soneProperties = new HashMap<String, Object>();
+                       Map<String, Object> soneProperties = new HashMap<>();
                        soneProperties.put("id", sone.getId());
                        soneProperties.put("name", sone.getName());
                        soneProperties.put("time", currentTimeMillis());
@@ -303,8 +303,8 @@ public class SoneInserter extends AbstractService {
                        soneProperties.put("profile", sone.getProfile());
                        soneProperties.put("posts", Ordering.from(Post.NEWEST_FIRST).sortedCopy(sone.getPosts()));
                        soneProperties.put("replies", Ordering.from(Reply.TIME_COMPARATOR).reverse().sortedCopy(sone.getReplies()));
-                       soneProperties.put("likedPostIds", new HashSet<String>(sone.getLikedPostIds()));
-                       soneProperties.put("likedReplyIds", new HashSet<String>(sone.getLikedReplyIds()));
+                       soneProperties.put("likedPostIds", new HashSet<>(sone.getLikedPostIds()));
+                       soneProperties.put("likedReplyIds", new HashSet<>(sone.getLikedReplyIds()));
                        soneProperties.put("albums", FluentIterable.from(sone.getRootAlbum().getAlbums()).transformAndConcat(Album.FLATTENER).filter(NOT_EMPTY).toList());
                        manifestCreator = new ManifestCreator(core, soneProperties);
                }
@@ -328,7 +328,7 @@ public class SoneInserter extends AbstractService {
                 * @return The manifest entries for the Sone insert
                 */
                public HashMap<String, Object> generateManifestEntries() {
-                       HashMap<String, Object> manifestEntries = new HashMap<String, Object>();
+                       HashMap<String, Object> manifestEntries = new HashMap<>();
 
                        /* first, create an index.html. */
                        manifestEntries.put("index.html", manifestCreator.createManifestElement(
@@ -358,7 +358,7 @@ public class SoneInserter extends AbstractService {
 
                private final Core core;
                private final Map<String, Object> soneProperties;
-               private final Set<Bucket> buckets = new HashSet<Bucket>();
+               private final Set<Bucket> buckets = new HashSet<>();
 
                ManifestCreator(Core core, Map<String, Object> soneProperties) {
                        this.core = core;
index ce0606b..1f30565 100644 (file)
@@ -166,7 +166,7 @@ public class SoneParser {
 
                /* parse posts. */
                SimpleXML postsXml = soneXml.getNode("posts");
-               Set<Post> posts = new HashSet<Post>();
+               Set<Post> posts = new HashSet<>();
                if (postsXml == null) {
                        /* TODO - mark Sone as bad. */
                        logger.log(Level.WARNING, String.format("Downloaded Sone %s has no posts!", sone));
@@ -199,7 +199,7 @@ public class SoneParser {
 
                /* parse replies. */
                SimpleXML repliesXml = soneXml.getNode("replies");
-               Set<PostReply> replies = new HashSet<PostReply>();
+               Set<PostReply> replies = new HashSet<>();
                if (repliesXml == null) {
                        /* TODO - mark Sone as bad. */
                        logger.log(Level.WARNING, String.format("Downloaded Sone %s has no replies!", sone));
@@ -229,7 +229,7 @@ public class SoneParser {
 
                /* parse liked post IDs. */
                SimpleXML likePostIdsXml = soneXml.getNode("post-likes");
-               Set<String> likedPostIds = new HashSet<String>();
+               Set<String> likedPostIds = new HashSet<>();
                if (likePostIdsXml == null) {
                        /* TODO - mark Sone as bad. */
                        logger.log(Level.WARNING, String.format("Downloaded Sone %s has no post likes!", sone));
@@ -242,7 +242,7 @@ public class SoneParser {
 
                /* parse liked reply IDs. */
                SimpleXML likeReplyIdsXml = soneXml.getNode("reply-likes");
-               Set<String> likedReplyIds = new HashSet<String>();
+               Set<String> likedReplyIds = new HashSet<>();
                if (likeReplyIdsXml == null) {
                        /* TODO - mark Sone as bad. */
                        logger.log(Level.WARNING, String.format("Downloaded Sone %s has no reply likes!", sone));
@@ -255,8 +255,8 @@ public class SoneParser {
 
                /* parse albums. */
                SimpleXML albumsXml = soneXml.getNode("albums");
-               Map<String, Image> allImages = new HashMap<String, Image>();
-               List<Album> topLevelAlbums = new ArrayList<Album>();
+               Map<String, Image> allImages = new HashMap<>();
+               List<Album> topLevelAlbums = new ArrayList<>();
                if (albumsXml != null) {
                        for (SimpleXML albumXml : albumsXml.getNodes("album")) {
                                String id = albumXml.getValue("id", null);
index 8cac572..f120f85 100644 (file)
@@ -55,7 +55,7 @@ public class WebOfTrustUpdaterImpl extends AbstractService implements WebOfTrust
        private final WebOfTrustConnector webOfTrustConnector;
 
        /** The queue for jobs. */
-       private final BlockingQueue<WebOfTrustUpdateJob> updateJobs = new LinkedBlockingQueue<WebOfTrustUpdateJob>();
+       private final BlockingQueue<WebOfTrustUpdateJob> updateJobs = new LinkedBlockingQueue<>();
 
        /**
         * Creates a new trust updater.
index f90a42f..1104929 100644 (file)
@@ -44,7 +44,7 @@ public interface Album extends Identified, Fingerprintable {
                        if (album == null) {
                                return emptyList();
                        }
-                       List<Album> albums = new ArrayList<Album>();
+                       List<Album> albums = new ArrayList<>();
                        albums.add(album);
                        for (Album subAlbum : album.getAlbums()) {
                                albums.addAll(FluentIterable.from(ImmutableList.of(subAlbum)).transformAndConcat(FLATTENER).toList());
index d3ce38e..c3ffe60 100644 (file)
@@ -282,7 +282,7 @@ public class Profile implements Fingerprintable {
         */
        @Nonnull
        public List<Field> getFields() {
-               return new ArrayList<Field>(fields);
+               return new ArrayList<>(fields);
        }
 
        /**
index f87273c..dff3912 100644 (file)
@@ -51,13 +51,13 @@ public class AlbumImpl implements Album {
        private final Sone sone;
 
        /** Nested albums. */
-       private final List<Album> albums = new ArrayList<Album>();
+       private final List<Album> albums = new ArrayList<>();
 
        /** The image IDs in order. */
-       private final List<String> imageIds = new ArrayList<String>();
+       private final List<String> imageIds = new ArrayList<>();
 
        /** The images in this album. */
-       private final Map<String, Image> images = new HashMap<String, Image>();
+       private final Map<String, Image> images = new HashMap<>();
 
        /** The parent album. */
        private Album parent;
@@ -100,7 +100,7 @@ public class AlbumImpl implements Album {
 
        @Override
        public List<Album> getAlbums() {
-               return new ArrayList<Album>(albums);
+               return new ArrayList<>(albums);
        }
 
        @Override
@@ -152,7 +152,7 @@ public class AlbumImpl implements Album {
 
        @Override
        public List<Image> getImages() {
-               return new ArrayList<Image>(Collections2.filter(Collections2.transform(imageIds, new Function<String, Image>() {
+               return new ArrayList<>(Collections2.filter(Collections2.transform(imageIds, new Function<String, Image>() {
 
                        @Override
                        @SuppressWarnings("synthetic-access")
index e4bedb0..2a5d29a 100644 (file)
@@ -93,16 +93,16 @@ public class SoneImpl implements Sone {
        private volatile boolean known;
 
        /** All posts. */
-       private final Set<Post> posts = new CopyOnWriteArraySet<Post>();
+       private final Set<Post> posts = new CopyOnWriteArraySet<>();
 
        /** All replies. */
-       private final Set<PostReply> replies = new CopyOnWriteArraySet<PostReply>();
+       private final Set<PostReply> replies = new CopyOnWriteArraySet<>();
 
        /** The IDs of all liked posts. */
-       private final Set<String> likedPostIds = new CopyOnWriteArraySet<String>();
+       private final Set<String> likedPostIds = new CopyOnWriteArraySet<>();
 
        /** The IDs of all liked replies. */
-       private final Set<String> likedReplyIds = new CopyOnWriteArraySet<String>();
+       private final Set<String> likedReplyIds = new CopyOnWriteArraySet<>();
 
        /** The root album containing all albums. */
        private final Album rootAlbum = new AlbumImpl(this);
@@ -381,7 +381,7 @@ public class SoneImpl implements Sone {
        public List<Post> getPosts() {
                List<Post> sortedPosts;
                synchronized (this) {
-                       sortedPosts = new ArrayList<Post>(posts);
+                       sortedPosts = new ArrayList<>(posts);
                }
                Collections.sort(sortedPosts, Post.NEWEST_FIRST);
                return sortedPosts;
@@ -642,7 +642,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<PostReply> replies = new ArrayList<PostReply>(getReplies());
+               List<PostReply> replies = new ArrayList<>(getReplies());
                Collections.sort(replies, Reply.TIME_COMPARATOR);
                hash.putString("Replies(");
                for (PostReply reply : replies) {
@@ -650,7 +650,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<String> likedPostIds = new ArrayList<String>(getLikedPostIds());
+               List<String> likedPostIds = new ArrayList<>(getLikedPostIds());
                Collections.sort(likedPostIds);
                hash.putString("LikedPosts(");
                for (String likedPostId : likedPostIds) {
@@ -658,7 +658,7 @@ public class SoneImpl implements Sone {
                }
                hash.putString(")");
 
-               List<String> likedReplyIds = new ArrayList<String>(getLikedReplyIds());
+               List<String> likedReplyIds = new ArrayList<>(getLikedReplyIds());
                Collections.sort(likedReplyIds);
                hash.putString("LikedReplies(");
                for (String likedReplyId : likedReplyIds) {
index 661bfe8..268f1a2 100644 (file)
@@ -93,7 +93,7 @@ public class ConfigurationLoader {
        }
 
        private Set<String> loadIds(String prefix) {
-               Set<String> ids = new HashSet<String>();
+               Set<String> ids = new HashSet<>();
                int idCounter = 0;
                while (true) {
                        String id = configuration
index cc0127c..1a4e119 100644 (file)
@@ -22,7 +22,7 @@ public class MemoryBookmarkDatabase implements BookmarkDatabase {
        private final ReadWriteLock lock = new ReentrantReadWriteLock();
        private final MemoryDatabase memoryDatabase;
        private final ConfigurationLoader configurationLoader;
-       private final Set<String> bookmarkedPosts = new HashSet<String>();
+       private final Set<String> bookmarkedPosts = new HashSet<>();
 
        public MemoryBookmarkDatabase(MemoryDatabase memoryDatabase,
                        ConfigurationLoader configurationLoader) {
index 11c1611..e190aef 100644 (file)
@@ -81,7 +81,7 @@ public class FcpInterface {
        private final AtomicBoolean active = new AtomicBoolean();
 
        /** What function full access is required for. */
-       private final AtomicReference<FullAccessRequired> fullAccessRequired = new AtomicReference<FullAccessRequired>(FullAccessRequired.ALWAYS);
+       private final AtomicReference<FullAccessRequired> fullAccessRequired = new AtomicReference<>(FullAccessRequired.ALWAYS);
 
        /** All available FCP commands. */
        private final Map<String, AbstractSoneCommand> commands;
index 1e2ca7d..d837145 100644 (file)
@@ -57,7 +57,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand {
                int startPost = getInt(parameters, "StartPost", 0);
                int maxPosts = getInt(parameters, "MaxPosts", -1);
 
-               Collection<Post> allPosts = new HashSet<Post>();
+               Collection<Post> allPosts = new HashSet<>();
                allPosts.addAll(sone.getPosts());
                for (String friendSoneId : sone.getFriends()) {
                        Sone friendSone = getCore().getSone(friendSoneId);
@@ -69,7 +69,7 @@ public class GetPostFeedCommand extends AbstractSoneCommand {
                allPosts.addAll(getCore().getDirectedPosts(sone.getId()));
                allPosts = Collections2.filter(allPosts, Post.FUTURE_POSTS_FILTER);
 
-               List<Post> sortedPosts = new ArrayList<Post>(allPosts);
+               List<Post> sortedPosts = new ArrayList<>(allPosts);
                Collections.sort(sortedPosts, Post.NEWEST_FIRST);
 
                if (sortedPosts.size() < startPost) {
index 3ff234a..2c53562 100644 (file)
@@ -49,7 +49,7 @@ public class GetSonesCommand extends AbstractSoneCommand {
        public Response execute(SimpleFieldSet parameters) {
                int startSone = getInt(parameters, "StartSone", 0);
                int maxSones = getInt(parameters, "MaxSones", -1);
-               List<Sone> sones = new ArrayList<Sone>(getCore().getSones());
+               List<Sone> sones = new ArrayList<>(getCore().getSones());
                if (sones.size() < startSone) {
                        return new Response("Sones", encodeSones(Collections.<Sone> emptyList(), "Sones."));
                }
index 229b8e1..12e1c12 100644 (file)
@@ -71,7 +71,7 @@ public class L10nFilter implements Filter {
                if (data instanceof L10nText) {
                        return ((L10nText) data).getParameters();
                }
-               List<Object> parameterValues = new ArrayList<Object>();
+               List<Object> parameterValues = new ArrayList<>();
                int parameterIndex = 0;
                while (parameters.containsKey(String.valueOf(parameterIndex))) {
                        Object value = parameters.get(String.valueOf(parameterIndex));
index a17b0bc..ff7e65f 100644 (file)
@@ -55,7 +55,7 @@ public class IdentityLoader {
        }
 
        private Map<OwnIdentity, Collection<Identity>> loadTrustedIdentitiesForOwnIdentities(Collection<OwnIdentity> ownIdentities) throws PluginException {
-               Map<OwnIdentity, Collection<Identity>> currentIdentities = new HashMap<OwnIdentity, Collection<Identity>>();
+               Map<OwnIdentity, Collection<Identity>> currentIdentities = new HashMap<>();
 
                for (OwnIdentity ownIdentity : ownIdentities) {
                        if (identityDoesNotHaveTheCorrectContext(ownIdentity)) {
index a9f3613..7d8d1e4 100644 (file)
@@ -107,7 +107,7 @@ public class IdentityManagerImpl extends AbstractService implements IdentityMana
        @Override
        public Set<OwnIdentity> getAllOwnIdentities() {
                synchronized (currentOwnIdentities) {
-                       return new HashSet<OwnIdentity>(currentOwnIdentities);
+                       return new HashSet<>(currentOwnIdentities);
                }
        }
 
@@ -120,7 +120,7 @@ public class IdentityManagerImpl extends AbstractService implements IdentityMana
         */
        @Override
        protected void serviceRun() {
-               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<OwnIdentity, Collection<Identity>>();
+               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<>();
 
                while (!shouldStop()) {
                        try {
index 1d30efb..de3f23a 100644 (file)
@@ -96,7 +96,7 @@ public class WebOfTrustConnector {
                Reply reply = performRequest(SimpleFieldSetConstructor.create().put("Message", "GetOwnIdentities").get());
                SimpleFieldSet fields = reply.getFields();
                int ownIdentityCounter = -1;
-               Set<OwnIdentity> ownIdentities = new HashSet<OwnIdentity>();
+               Set<OwnIdentity> ownIdentities = new HashSet<>();
                while (true) {
                        String id = fields.get("Identity" + ++ownIdentityCounter);
                        if (id == null) {
@@ -142,7 +142,7 @@ public class WebOfTrustConnector {
        public Set<Identity> loadTrustedIdentities(OwnIdentity ownIdentity, Optional<String> context) throws PluginException {
                Reply reply = performRequest(SimpleFieldSetConstructor.create().put("Message", "GetIdentitiesByScore").put("Truster", ownIdentity.getId()).put("Selection", "+").put("Context", context.or("")).put("WantTrustValues", "true").get());
                SimpleFieldSet fields = reply.getFields();
-               Set<Identity> identities = new HashSet<Identity>();
+               Set<Identity> identities = new HashSet<>();
                int identityCounter = -1;
                while (true) {
                        String id = fields.get("Identity" + ++identityCounter);
@@ -329,7 +329,7 @@ public class WebOfTrustConnector {
         * @return The parsed contexts
         */
        private static Set<String> parseContexts(String prefix, SimpleFieldSet fields) {
-               Set<String> contexts = new HashSet<String>();
+               Set<String> contexts = new HashSet<>();
                int contextCounter = -1;
                while (true) {
                        String context = fields.get(prefix + "Context" + ++contextCounter);
@@ -351,7 +351,7 @@ public class WebOfTrustConnector {
         * @return The parsed properties
         */
        private static Map<String, String> parseProperties(String prefix, SimpleFieldSet fields) {
-               Map<String, String> properties = new HashMap<String, String>();
+               Map<String, String> properties = new HashMap<>();
                int propertiesCounter = -1;
                while (true) {
                        String propertyName = fields.get(prefix + "Property" + ++propertiesCounter + ".Name");
index 8317290..c42b056 100644 (file)
@@ -28,7 +28,7 @@ public class DebugLoaders implements Loaders {
 
        @Override
        public <REQ extends Request> Page<REQ> loadStaticPage(String basePath, String prefix, String mimeType) {
-               return new ReloadingPage<REQ>(basePath, new File(filesystemPath, prefix).getAbsolutePath(), mimeType);
+               return new ReloadingPage<>(basePath, new File(filesystemPath, prefix).getAbsolutePath(), mimeType);
        }
 
        @Override
index 039639e..11b0829 100644 (file)
@@ -37,7 +37,7 @@ public class ListNotification<T> extends TemplateNotification {
        private final String key;
 
        /** The list of new elements. */
-       private final List<T> elements = new CopyOnWriteArrayList<T>();
+       private final List<T> elements = new CopyOnWriteArrayList<>();
 
        /**
         * Creates a new list notification.
@@ -96,7 +96,7 @@ public class ListNotification<T> extends TemplateNotification {
         * @return The current list of elements
         */
        public List<T> getElements() {
-               return new ArrayList<T>(elements);
+               return new ArrayList<>(elements);
        }
 
        /**
index 5db5258..2308353 100644 (file)
@@ -65,7 +65,7 @@ public class ListNotificationFilter {
         */
        @SuppressWarnings("unchecked")
        public List<Notification> filterNotifications(Collection<? extends Notification> notifications, Sone currentSone) {
-               List<Notification> filteredNotifications = new ArrayList<Notification>();
+               List<Notification> filteredNotifications = new ArrayList<>();
                for (Notification notification : notifications) {
                        if (notification.getId().equals("new-sone-notification")) {
                                if ((currentSone != null) && !currentSone.getOptions().isShowNewSoneNotifications()) {
@@ -126,7 +126,7 @@ public class ListNotificationFilter {
                if (newPosts.size() == postNotification.getElements().size()) {
                        return Optional.of(postNotification);
                }
-               ListNotification<Post> filteredNotification = new ListNotification<Post>(postNotification);
+               ListNotification<Post> filteredNotification = new ListNotification<>(postNotification);
                filteredNotification.setElements(newPosts);
                filteredNotification.setLastUpdateTime(postNotification.getLastUpdatedTime());
                return Optional.of(filteredNotification);
@@ -155,7 +155,7 @@ public class ListNotificationFilter {
                if (newReplies.size() == newReplyNotification.getElements().size()) {
                        return Optional.of(newReplyNotification);
                }
-               ListNotification<PostReply> filteredNotification = new ListNotification<PostReply>(newReplyNotification);
+               ListNotification<PostReply> filteredNotification = new ListNotification<>(newReplyNotification);
                filteredNotification.setElements(newReplies);
                filteredNotification.setLastUpdateTime(newReplyNotification.getLastUpdatedTime());
                return Optional.of(filteredNotification);
index f7b6f62..909f498 100644 (file)
@@ -43,7 +43,7 @@ public class AlbumAccessor extends ReflectionAccessor {
        public Object get(TemplateContext templateContext, Object object, String member) {
                Album album = (Album) object;
                if ("backlinks".equals(member)) {
-                       List<Link> backlinks = new ArrayList<Link>();
+                       List<Link> backlinks = new ArrayList<>();
                        Album currentAlbum = album;
                        while (!currentAlbum.isRoot()) {
                                backlinks.add(0, new Link("imageBrowser.html?album=" + currentAlbum.getId(), currentAlbum.getTitle()));
index c9c7374..a8f87ca 100644 (file)
@@ -45,7 +45,7 @@ public class CollectionAccessor extends ReflectionAccessor {
        public Object get(TemplateContext templateContext, Object object, String member) {
                Collection<?> collection = (Collection<?>) object;
                if (member.equals("soneNames")) {
-                       List<Sone> sones = new ArrayList<Sone>();
+                       List<Sone> sones = new ArrayList<>();
                        for (Object sone : collection) {
                                if (!(sone instanceof Sone)) {
                                        continue;
index dfc1dd7..7c7da4c 100644 (file)
@@ -26,9 +26,9 @@ import com.google.common.base.Charsets;
 public class FilesystemTemplate extends Template {
 
        private final String filename;
-       private final AtomicReference<LastLoadedTemplate> lastTemplate = new AtomicReference<LastLoadedTemplate>();
+       private final AtomicReference<LastLoadedTemplate> lastTemplate = new AtomicReference<>();
        private final TemplateContext initialContext = new TemplateContext();
-       private final List<Part> parts = new ArrayList<Part>();
+       private final List<Part> parts = new ArrayList<>();
 
        public FilesystemTemplate(String filename) {
                this.filename = filename;
index b204706..87b4fe5 100644 (file)
@@ -46,7 +46,7 @@ public class RequestChangeFilter implements Filter {
                String name = String.valueOf(parameters.get("name"));
                String value = String.valueOf(parameters.get("value"));
 
-               Map<String, String> values = new HashMap<String, String>();
+               Map<String, String> values = new HashMap<>();
                Collection<String> parameterNames = request.getHttpRequest().getParameterNames();
                for (String parameterName : parameterNames) {
                        values.put(parameterName, request.getHttpRequest().getParam(parameterName));
index 4705e6f..5ec2cd9 100644 (file)
@@ -38,7 +38,7 @@ public class UniqueElementFilter implements Filter {
                if (!(data instanceof Collection<?>)) {
                        return data;
                }
-               return new HashSet<Object>((Collection<?>) data);
+               return new HashSet<>((Collection<?>) data);
        }
 
 }
index 5342292..cd776d7 100644 (file)
@@ -237,7 +237,7 @@ public class WebInterface implements SessionProvider {
        private final SonePlugin sonePlugin;
 
        /** The registered toadlets. */
-       private final List<PageToadlet> pageToadlets = new ArrayList<PageToadlet>();
+       private final List<PageToadlet> pageToadlets = new ArrayList<>();
 
        /** The form password. */
        private final String formPassword;
@@ -281,7 +281,7 @@ public class WebInterface implements SessionProvider {
        private final ListNotification<Post> mentionNotification;
 
        /** Notifications for sone inserts. */
-       private final Map<Sone, TemplateNotification> soneInsertNotifications = new HashMap<Sone, TemplateNotification>();
+       private final Map<Sone, TemplateNotification> soneInsertNotifications = new HashMap<>();
 
        /** Sone locked notification ticker objects. */
        private final Map<Sone, ScheduledFuture<?>> lockedSonesTickerObjects = Collections.synchronizedMap(new HashMap<Sone, ScheduledFuture<?>>());
@@ -366,37 +366,37 @@ public class WebInterface implements SessionProvider {
 
                /* create notifications. */
                Template newSoneNotificationTemplate = loaders.loadTemplate("/templates/notify/newSoneNotification.html");
-               newSoneNotification = new ListNotification<Sone>("new-sone-notification", "sones", newSoneNotificationTemplate, false);
+               newSoneNotification = new ListNotification<>("new-sone-notification", "sones", newSoneNotificationTemplate, false);
 
                Template newPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html");
-               newPostNotification = new ListNotification<Post>("new-post-notification", "posts", newPostNotificationTemplate, false);
+               newPostNotification = new ListNotification<>("new-post-notification", "posts", newPostNotificationTemplate, false);
 
                Template localPostNotificationTemplate = loaders.loadTemplate("/templates/notify/newPostNotification.html");
-               localPostNotification = new ListNotification<Post>("local-post-notification", "posts", localPostNotificationTemplate, false);
+               localPostNotification = new ListNotification<>("local-post-notification", "posts", localPostNotificationTemplate, false);
 
                Template newReplyNotificationTemplate = loaders.loadTemplate("/templates/notify/newReplyNotification.html");
-               newReplyNotification = new ListNotification<PostReply>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
+               newReplyNotification = new ListNotification<>("new-reply-notification", "replies", newReplyNotificationTemplate, false);
 
                Template localReplyNotificationTemplate = loaders.loadTemplate("/templates/notify/newReplyNotification.html");
-               localReplyNotification = new ListNotification<PostReply>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
+               localReplyNotification = new ListNotification<>("local-reply-notification", "replies", localReplyNotificationTemplate, false);
 
                Template mentionNotificationTemplate = loaders.loadTemplate("/templates/notify/mentionNotification.html");
-               mentionNotification = new ListNotification<Post>("mention-notification", "posts", mentionNotificationTemplate, false);
+               mentionNotification = new ListNotification<>("mention-notification", "posts", mentionNotificationTemplate, false);
 
                Template lockedSonesTemplate = loaders.loadTemplate("/templates/notify/lockedSonesNotification.html");
-               lockedSonesNotification = new ListNotification<Sone>("sones-locked-notification", "sones", lockedSonesTemplate);
+               lockedSonesNotification = new ListNotification<>("sones-locked-notification", "sones", lockedSonesTemplate);
 
                Template newVersionTemplate = loaders.loadTemplate("/templates/notify/newVersionNotification.html");
                newVersionNotification = new TemplateNotification("new-version-notification", newVersionTemplate);
 
                Template insertingImagesTemplate = loaders.loadTemplate("/templates/notify/inserting-images-notification.html");
-               insertingImagesNotification = new ListNotification<Image>("inserting-images-notification", "images", insertingImagesTemplate);
+               insertingImagesNotification = new ListNotification<>("inserting-images-notification", "images", insertingImagesTemplate);
 
                Template insertedImagesTemplate = loaders.loadTemplate("/templates/notify/inserted-images-notification.html");
-               insertedImagesNotification = new ListNotification<Image>("inserted-images-notification", "images", insertedImagesTemplate);
+               insertedImagesNotification = new ListNotification<>("inserted-images-notification", "images", insertedImagesTemplate);
 
                Template imageInsertFailedTemplate = loaders.loadTemplate("/templates/notify/image-insert-failed-notification.html");
-               imageInsertFailedNotification = new ListNotification<Image>("image-insert-failed-notification", "images", imageInsertFailedTemplate);
+               imageInsertFailedNotification = new ListNotification<>("image-insert-failed-notification", "images", imageInsertFailedTemplate);
        }
 
        //
@@ -829,7 +829,7 @@ public class WebInterface implements SessionProvider {
         */
        private Collection<Sone> getMentionedSones(String text) {
                /* we need no context to find mentioned Sones. */
-               Set<Sone> mentionedSones = new HashSet<Sone>();
+               Set<Sone> mentionedSones = new HashSet<>();
                for (Part part : soneTextParser.parse(text, null)) {
                        if (part instanceof SonePart) {
                                mentionedSones.add(((SonePart) part).getSone());
index c515e5f..16cf6c2 100644 (file)
@@ -145,7 +145,7 @@ public class PageToadlet extends Toadlet implements LinkEnabledCallback, LinkFil
                try (AutoCloseableBucket pageBucket = new AutoCloseableBucket(pageRequest.getToadletContext().getBucketFactory().makeBucket(-1));
                     OutputStream pageBucketOutputStream = pageBucket.getBucket().getOutputStream()) {
                        Response pageResponse = page.handleRequest(pageRequest, new Response(pageBucketOutputStream));
-                       MultiValueTable<String, String> headers = new MultiValueTable<String, String>();
+                       MultiValueTable<String, String> headers = new MultiValueTable<>();
                        if (pageResponse.getHeaders() != null) {
                                for (Header header : pageResponse.getHeaders()) {
                                        for (String value : header) {
index 4a77dd4..c91de68 100644 (file)
@@ -212,7 +212,7 @@ public class FreenetInterfaceTest {
        @Test
        public void insertingADirectory() throws InsertException, SoneException {
                FreenetURI freenetUri = mock(FreenetURI.class);
-               HashMap<String, Object> manifestEntries = new HashMap<String, Object>();
+               HashMap<String, Object> manifestEntries = new HashMap<>();
                String defaultFile = "index.html";
                FreenetURI resultingUri = mock(FreenetURI.class);
                when(highLevelSimpleClient.insertManifest(eq(freenetUri), eq(manifestEntries), eq(defaultFile))).thenReturn(resultingUri);
index 32926e8..94eabb0 100644 (file)
@@ -248,7 +248,7 @@ public class SoneInserterTest {
        @Test
        public void templateIsRenderedCorrectlyForManifestElement()
        throws IOException {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                soneProperties.put("id", "SoneId");
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                long now = currentTimeMillis();
@@ -264,7 +264,7 @@ public class SoneInserterTest {
 
        @Test
        public void invalidTemplateReturnsANullManifestElement() {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                assertThat(manifestCreator.createManifestElement("test.txt",
                                "plain/text; charset=utf-8",
@@ -274,7 +274,7 @@ public class SoneInserterTest {
 
        @Test
        public void errorWhileRenderingTemplateReturnsANullManifestElement() {
-               Map<String, Object> soneProperties = new HashMap<String, Object>();
+               Map<String, Object> soneProperties = new HashMap<>();
                ManifestCreator manifestCreator = new ManifestCreator(core, soneProperties);
                when(core.toString()).thenThrow(NullPointerException.class);
                assertThat(manifestCreator.createManifestElement("test.txt",
index fa5b0b1..400b9ae 100644 (file)
@@ -68,20 +68,20 @@ public class SoneParserTest {
        private final Sone sone = mock(Sone.class);
        private FreenetURI requestUri = mock(FreenetURI.class);
        private final PostBuilder postBuilder = mock(PostBuilder.class);
-       private final List<Post> createdPosts = new ArrayList<Post>();
+       private final List<Post> createdPosts = new ArrayList<>();
        private Post post = mock(Post.class);
        private final PostReplyBuilder postReplyBuilder = mock(PostReplyBuilder.class);
-       private final Set<PostReply> createdPostReplies = new HashSet<PostReply>();
+       private final Set<PostReply> createdPostReplies = new HashSet<>();
        private PostReply postReply = mock(PostReply.class);
        private final AlbumBuilder albumBuilder = mock(AlbumBuilder.class);
        private final ListMultimap<Album, Album>
                        nestedAlbums = ArrayListMultimap.create();
        private final ListMultimap<Album, Image> albumImages = ArrayListMultimap.create();
        private Album album = mock(Album.class);
-       private final Map<String, Album> albums = new HashMap<String, Album>();
+       private final Map<String, Album> albums = new HashMap<>();
        private final ImageBuilder imageBuilder = mock(ImageBuilder.class);
        private Image image = mock(Image.class);
-       private final Map<String, Image> images = new HashMap<String, Image>();
+       private final Map<String, Image> images = new HashMap<>();
 
        @Before
        public void setupSone() {
index 24481bf..188b740 100644 (file)
@@ -33,7 +33,7 @@ public class MemoryBookmarkDatabaseTest {
                        mock(ConfigurationLoader.class);
        private final MemoryBookmarkDatabase bookmarkDatabase =
                        new MemoryBookmarkDatabase(memoryDatabase, configurationLoader);
-       private final Map<String, Post> posts = new HashMap<String, Post>();
+       private final Map<String, Post> posts = new HashMap<>();
 
        @Before
        public void setupMemoryDatabase() {
@@ -67,7 +67,7 @@ public class MemoryBookmarkDatabaseTest {
 
        @Test
        public void bookmarkDatabaseRetainsBookmarkedPosts() {
-               Set<Post> allPosts = new HashSet<Post>(posts.values());
+               Set<Post> allPosts = new HashSet<>(posts.values());
                for (Post post : allPosts) {
                        bookmarkDatabase.bookmarkPost(post);
                }
@@ -98,7 +98,7 @@ public class MemoryBookmarkDatabaseTest {
 
        @Test
        public void removingABookmarkRemovesTheCorrectBookmark() {
-               Set<Post> allPosts = new HashSet<Post>(posts.values());
+               Set<Post> allPosts = new HashSet<>(posts.values());
                for (Post post : allPosts) {
                        bookmarkDatabase.bookmarkPost(post);
                }
index 8ac30e2..cfae82e 100644 (file)
@@ -120,7 +120,7 @@ public class MemoryDatabaseTest {
                                                .withTime(4000L)
                                                .withText("reply2")
                                                .build();
-               Set<PostReply> postReplies = new HashSet<PostReply>(
+               Set<PostReply> postReplies = new HashSet<>(
                                asList(firstPostFirstReply, firstPostSecondReply,
                                                secondPostReply));
                when(sone.getReplies()).thenReturn(postReplies);
index 0b3e605..26d22a2 100644 (file)
@@ -75,14 +75,14 @@ public class IdentityChangeEventSenderTest {
        }
 
        private Map<OwnIdentity, Collection<Identity>> createNewIdentities() {
-               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<OwnIdentity, Collection<Identity>>();
+               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<>();
                oldIdentities.put(ownIdentities.get(1), asList(identities.get(3), identities.get(2)));
                oldIdentities.put(ownIdentities.get(2), asList(identities.get(1), identities.get(2)));
                return oldIdentities;
        }
 
        private Map<OwnIdentity, Collection<Identity>> createOldIdentities() {
-               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<OwnIdentity, Collection<Identity>>();
+               Map<OwnIdentity, Collection<Identity>> oldIdentities = new HashMap<>();
                oldIdentities.put(ownIdentities.get(0), asList(identities.get(0), identities.get(1)));
                oldIdentities.put(ownIdentities.get(1), asList(identities.get(0), identities.get(1)));
                return oldIdentities;
index a31621f..5e40f81 100644 (file)
@@ -34,7 +34,7 @@ public class ListNotificationTest {
 
        public ListNotificationTest() {
                when(template.getInitialContext()).thenReturn(templateInitialContext);
-               listNotification = new ListNotification<Object>(ID, KEY, template);
+               listNotification = new ListNotification<>(ID, KEY, template);
        }
 
        @Test
index af76458..e83693a 100644 (file)
@@ -20,7 +20,7 @@ import org.junit.Test;
 public class CollectionAccessorTest {
 
        private final CollectionAccessor accessor = new CollectionAccessor();
-       private final Collection<Object> collection = new ArrayList<Object>();
+       private final Collection<Object> collection = new ArrayList<>();
 
        @Before
        public void setupCollection() {
index b96ed49..9259ef5 100644 (file)
@@ -27,7 +27,7 @@ public class FilesystemTemplateTest {
 
        private final File tempFile;
        private final FilesystemTemplate filesystemTemplate;
-       private final AtomicReference<StringWriter> stringWriter = new AtomicReference<StringWriter>(new StringWriter());
+       private final AtomicReference<StringWriter> stringWriter = new AtomicReference<>(new StringWriter());
        private final TemplateContext templateContext = new TemplateContext();
 
        public FilesystemTemplateTest() throws IOException {
index c1c4581..cefc8b0 100644 (file)
@@ -24,7 +24,7 @@ public class GetPagePluginTest {
        private final TemplateContext context = mock(TemplateContext.class);
        private final FreenetRequest request = mock(FreenetRequest.class);
        private final Map<String, String> parameters =
-                       new HashMap<String, String>();
+                       new HashMap<>();
        private HTTPRequest httpRequest = mock(HTTPRequest.class);
 
        @Before
index 25d67b5..e091566 100644 (file)
@@ -24,8 +24,8 @@ import org.mockito.stubbing.Answer;
 public class TestAlbumBuilder implements AlbumBuilder {
 
        private final Album album = mock(Album.class);
-       private final List<Album> albums = new ArrayList<Album>();
-       private final List<Image> images = new ArrayList<Image>();
+       private final List<Album> albums = new ArrayList<>();
+       private final List<Image> images = new ArrayList<>();
        private Album parentAlbum;
        private String title;
        private String description;
index d7e8759..6435d16 100644 (file)
@@ -15,7 +15,7 @@ import com.google.common.base.Objects;
  */
 public class TestValue<T> implements Value<T> {
 
-       private final AtomicReference<T> value = new AtomicReference<T>();
+       private final AtomicReference<T> value = new AtomicReference<>();
 
        public TestValue(@Nullable T originalValue) {
                value.set(originalValue);
@@ -58,7 +58,7 @@ public class TestValue<T> implements Value<T> {
 
        @Nonnull
        public static <T> Value<T> from(@Nullable T value) {
-               return new TestValue<T>(value);
+               return new TestValue<>(value);
        }
 
 }
index 8e6a93c..3c82c40 100644 (file)
@@ -25,19 +25,19 @@ public class DefaultOptionTest {
 
        @Test
        public void defaultOptionReturnsDefaultValueWhenUnset() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue);
                assertThat(defaultOption.get(), is(defaultValue));
        }
 
        @Test
        public void defaultOptionReturnsNullForRealWhenUnset() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue);
                assertThat(defaultOption.getReal(), nullValue());
        }
 
        @Test
        public void defaultOptionWillReturnSetValue() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue);
                Object newValue = new Object();
                defaultOption.set(newValue);
                assertThat(defaultOption.get(), is(newValue));
@@ -45,40 +45,40 @@ public class DefaultOptionTest {
 
        @Test
        public void defaultOptionWithValidatorAcceptsValidValues() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue, matchesAcceptedValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue, matchesAcceptedValue);
                defaultOption.set(acceptedValue);
                assertThat(defaultOption.get(), is(acceptedValue));
        }
 
        @Test(expected = IllegalArgumentException.class)
        public void defaultOptionWithValidatorRejectsInvalidValues() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue, matchesAcceptedValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue, matchesAcceptedValue);
                defaultOption.set(new Object());
        }
 
        @Test
        public void defaultOptionValidatesObjectsCorrectly() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue, matchesAcceptedValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue, matchesAcceptedValue);
                assertThat(defaultOption.validate(acceptedValue), is(true));
                assertThat(defaultOption.validate(new Object()), is(false));
        }
 
        @Test
        public void settingToNullWillRestoreDefaultValue() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue);
                defaultOption.set(null);
                assertThat(defaultOption.get(), is(defaultValue));
        }
 
        @Test
        public void validateWithoutValidatorWillValidateNull() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue);
                assertThat(defaultOption.validate(null), is(true));
        }
 
        @Test
        public void validateWithValidatorWillValidateNull() {
-               DefaultOption<Object> defaultOption = new DefaultOption<Object>(defaultValue, matchesAcceptedValue);
+               DefaultOption<Object> defaultOption = new DefaultOption<>(defaultValue, matchesAcceptedValue);
                assertThat(defaultOption.validate(null), is(true));
        }