JAL-1648 Fix review issue - remove usage of String.join
authortcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 11 Apr 2017 14:50:55 +0000 (15:50 +0100)
committertcofoegbu <tcnofoegbu@dundee.ac.uk>
Tue, 11 Apr 2017 14:50:55 +0000 (15:50 +0100)
src/jalview/fts/core/GFTSPanel.java
src/jalview/io/cache/AppCache.java

index 918b3c9..a338400 100644 (file)
@@ -838,7 +838,6 @@ public abstract class GFTSPanel extends JPanel implements GFTSPanelI, Cacheable
     String typed = txt_search.getEditor().getItem() == null ? ""
             : txt_search
             .getEditor().getItem().toString().trim();
-    System.out.println("Typed : " + typed);
     return typed;
   }
 
index 26e1eda..46f6df2 100644 (file)
@@ -118,8 +118,18 @@ public class AppCache implements AppCacheI
   public void persistCache(Cacheable cacheable)
   {
     String cacheKey = cacheable.getCacheKey();
-    LinkedHashSet<String> foundCache = getAllCachedItemsFor(cacheable);
-    String commaJoinedStr = String.join(CACHE_DELIMITER, foundCache);
-    Cache.setProperty(cacheKey, commaJoinedStr);
+    LinkedHashSet<String> foundCacheItems = getAllCachedItemsFor(cacheable);
+    StringBuffer delimitedCacheBuf = new StringBuffer();
+    for (String cacheItem : foundCacheItems)
+    {
+      delimitedCacheBuf.append(CACHE_DELIMITER).append(cacheItem);
+    }
+    if (delimitedCacheBuf.length() > 0)
+    {
+      delimitedCacheBuf.deleteCharAt(0);
+    }
+    String delimitedCacheString = delimitedCacheBuf.toString();
+
+    Cache.setProperty(cacheKey, delimitedCacheString);
   }
 }