equal
deleted
inserted
replaced
37 |
37 |
38 |
38 |
39 /** A cache for ZipFileIndex objects. */ |
39 /** A cache for ZipFileIndex objects. */ |
40 public class ZipFileIndexCache { |
40 public class ZipFileIndexCache { |
41 |
41 |
42 private final Map<File, ZipFileIndex> map = |
42 private final Map<File, ZipFileIndex> map = new HashMap<>(); |
43 new HashMap<File, ZipFileIndex>(); |
|
44 |
43 |
45 /** Get a shared instance of the cache. */ |
44 /** Get a shared instance of the cache. */ |
46 private static ZipFileIndexCache sharedInstance; |
45 private static ZipFileIndexCache sharedInstance; |
47 public synchronized static ZipFileIndexCache getSharedInstance() { |
46 public synchronized static ZipFileIndexCache getSharedInstance() { |
48 if (sharedInstance == null) |
47 if (sharedInstance == null) |
73 * @param openedOnly If true it returns a list of only opened ZipFileIndex entries, otherwise |
72 * @param openedOnly If true it returns a list of only opened ZipFileIndex entries, otherwise |
74 * all ZipFileEntry(s) are included into the list. |
73 * all ZipFileEntry(s) are included into the list. |
75 * @return A list of ZipFileIndex entries, or an empty list |
74 * @return A list of ZipFileIndex entries, or an empty list |
76 */ |
75 */ |
77 public synchronized List<ZipFileIndex> getZipFileIndexes(boolean openedOnly) { |
76 public synchronized List<ZipFileIndex> getZipFileIndexes(boolean openedOnly) { |
78 List<ZipFileIndex> zipFileIndexes = new ArrayList<ZipFileIndex>(); |
77 List<ZipFileIndex> zipFileIndexes = new ArrayList<>(); |
79 |
78 |
80 zipFileIndexes.addAll(map.values()); |
79 zipFileIndexes.addAll(map.values()); |
81 |
80 |
82 if (openedOnly) { |
81 if (openedOnly) { |
83 for(ZipFileIndex elem : zipFileIndexes) { |
82 for(ZipFileIndex elem : zipFileIndexes) { |