Ignore:
Timestamp:
2014-10-18T23:07:52+02:00 (10 years ago)
Author:
donvip
Message:

[josm_plugins] fix Java 7 / unused code warnings

Location:
applications/editors/josm/plugins/imagerycache/src/org
Files:
23 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/AsyncWriteEngine.java

    r30532 r30737  
    3636    protected final long threadNum = threadCounter.incrementAndGet();
    3737
    38     protected final BlockingQueue<Long> newRecids = new ArrayBlockingQueue<Long>(128);
     38    protected final BlockingQueue<Long> newRecids = new ArrayBlockingQueue<>(128);
    3939
    4040    protected volatile boolean closeInProgress = false;
     
    266266     */
    267267    public void setParentEngineReference(Engine parentEngineReference) {
    268         parentEngineWeakRef = new WeakReference<Engine>(parentEngineReference);
     268        parentEngineWeakRef = new WeakReference<>(parentEngineReference);
    269269    }
    270270
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/Atomic.java

    r29363 r30737  
    213213        long recid = db.getEngine().put(initVal, serializer);
    214214        db.getNameDir().put(name, recid);
    215         return new Var<E>(db.getEngine(), recid, serializer);
     215        return new Var<>(db.getEngine(), recid, serializer);
    216216    }
    217217
     
    230230        return  recid == null ?
    231231                createVar(db, name, null, serializer) :
    232                 new Var<E>(db.getEngine(),recid, serializer);
     232                new Var<>(db.getEngine(),recid, serializer);
    233233    }
    234234
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/BTreeMap.java

    r30532 r30737  
    114114
    115115    /** holds node level locks*/
    116     protected final LongConcurrentHashMap<Thread> nodeLocks = new LongConcurrentHashMap<Thread>();
     116    protected final LongConcurrentHashMap<Thread> nodeLocks = new LongConcurrentHashMap<>();
    117117
    118118    /** maximal node size allowed in this BTree*/
     
    963963    protected Entry<K, V> makeEntry(Object key, Object value) {
    964964        if(value instanceof ValRef) throw new InternalError();
    965         return new SimpleImmutableEntry<K, V>((K)key,  (V)value);
     965        return new SimpleImmutableEntry<>((K)key,  (V)value);
    966966    }
    967967
     
    13361336        if (fromKey == null || toKey == null)
    13371337            throw new NullPointerException();
    1338         return new SubMap<K,V>
     1338        return new SubMap<>
    13391339                ( this, fromKey, fromInclusive, toKey, toInclusive);
    13401340    }
     
    13451345        if (toKey == null)
    13461346            throw new NullPointerException();
    1347         return new SubMap<K,V>
     1347        return new SubMap<>
    13481348                (this, null, false, toKey, inclusive);
    13491349    }
     
    13541354        if (fromKey == null)
    13551355            throw new NullPointerException();
    1356         return new SubMap<K,V>
     1356        return new SubMap<>
    13571357                (this, fromKey, inclusive, null, false);
    13581358    }
     
    14211421    static final <E> List<E> toList(Collection<E> c) {
    14221422        // Using size() here would be a pessimization.
    1423         List<E> list = new ArrayList<E>();
     1423        List<E> list = new ArrayList<>();
    14241424        for (E e : c){
    14251425            list.add(e);
     
    15061506                                      E toElement,
    15071507                                      boolean toInclusive) {
    1508             return new KeySet<E>(m.subMap(fromElement, fromInclusive,
     1508            return new KeySet<>(m.subMap(fromElement, fromInclusive,
    15091509                    toElement,   toInclusive),hasValues);
    15101510        }
    15111511        @Override
    15121512                public NavigableSet<E> headSet(E toElement, boolean inclusive) {
    1513             return new KeySet<E>(m.headMap(toElement, inclusive),hasValues);
     1513            return new KeySet<>(m.headMap(toElement, inclusive),hasValues);
    15141514        }
    15151515        @Override
    15161516                public NavigableSet<E> tailSet(E fromElement, boolean inclusive) {
    1517             return new KeySet<E>(m.tailMap(fromElement, inclusive),hasValues);
     1517            return new KeySet<>(m.tailMap(fromElement, inclusive),hasValues);
    15181518        }
    15191519        @Override
     
    19371937                }
    19381938            }
    1939             return new SubMap<K,V>(m, fromKey, fromInclusive,
     1939            return new SubMap<>(m, fromKey, fromInclusive,
    19401940                    toKey, toInclusive);
    19411941        }
     
    19891989        @Override
    19901990        public NavigableSet<K> navigableKeySet() {
    1991             return new KeySet<K>((ConcurrentNavigableMap<K,Object>) this,m.hasValues);
     1991            return new KeySet<>((ConcurrentNavigableMap<K,Object>) this,m.hasValues);
    19921992        }
    19931993
     
    20322032        @Override
    20332033        public NavigableSet<K> keySet() {
    2034             return new KeySet<K>((ConcurrentNavigableMap<K,Object>) this, m.hasValues);
     2034            return new KeySet<>((ConcurrentNavigableMap<K,Object>) this, m.hasValues);
    20352035        }
    20362036
     
    20442044        @Override
    20452045        public Set<Entry<K, V>> entrySet() {
    2046             return new EntrySet<K, V>(this);
     2046            return new EntrySet<>(this);
    20472047        }
    20482048
     
    21232123        Engine snapshot = SnapshotEngine.createSnapshotFor(engine);
    21242124
    2125         return new BTreeMap<K, V>(snapshot,treeRecid, defaultSerializer);
     2125        return new BTreeMap<>(snapshot,treeRecid, defaultSerializer);
    21262126    }
    21272127
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheHardRef.java

    r29363 r30737  
    3131
    3232    public CacheHardRef(Engine engine, int initialCapacity) {
    33         super(engine, new LongConcurrentHashMap<Object>(initialCapacity));
     33        super(engine, new LongConcurrentHashMap<>(initialCapacity));
    3434    }
    3535
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheLRU.java

    r30532 r30737  
    1616
    1717    public CacheLRU(Engine engine, int cacheSize) {
    18         this(engine, new LongConcurrentLRUMap<Object>(cacheSize, (int) (cacheSize*0.8)));
     18        this(engine, new LongConcurrentLRUMap<>(cacheSize, (int) (cacheSize*0.8)));
    1919    }
    2020
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/CacheWeakSoftRef.java

    r29484 r30737  
    7979
    8080
    81     protected LongConcurrentHashMap<CacheItem> items = new LongConcurrentHashMap<CacheItem>();
     81    protected LongConcurrentHashMap<CacheItem> items = new LongConcurrentHashMap<>();
    8282
    8383
     
    157157        ReferenceQueue<A> q = checkClosed(queue);
    158158        checkClosed(items).put(recid, useWeakRef?
    159             new CacheWeakItem<A>(value, q, recid) :
    160             new CacheSoftItem<A>(value, q, recid));
     159            new CacheWeakItem<>(value, q, recid) :
     160            new CacheSoftItem<>(value, q, recid));
    161161    }
    162162
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/CompressLZF.java

    r29484 r30737  
    346346     */
    347347    public static <E> Serializer<E> CompressionWrapper(Serializer<E> serializer) {
    348         return new Serializer.CompressSerializerWrapper<E>(serializer);
     348        return new Serializer.CompressSerializerWrapper<>(serializer);
    349349    }
    350350
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/DB.java

    r29484 r30737  
    3232    protected Engine engine;
    3333    /** already loaded named collections. It is important to keep collections as singletons, because of 'in-memory' locking*/
    34     protected Map<String, WeakReference<?>> collections = new HashMap<String, WeakReference<?>>();
     34    protected Map<String, WeakReference<?>> collections = new HashMap<>();
    3535
    3636    /** view over named records */
     
    7979        if(recid!=null){
    8080            //open existing map
    81             ret = new HTreeMap<K,V>(engine, recid,defaultSerializer);
     81            ret = new HTreeMap<>(engine, recid,defaultSerializer);
    8282            if(!ret.hasValues) throw new ClassCastException("Collection is Set, not Map");
    8383        }else{
    8484            //create new map
    85             ret = new HTreeMap<K,V>(engine,true,false,Utils.RANDOM.nextInt(), defaultSerializer,null, null);
     85            ret = new HTreeMap<>(engine,true,false,Utils.RANDOM.nextInt(), defaultSerializer,null, null);
    8686            nameDir.put(name, ret.rootRecid);
    8787        }
     
    106106            String name, boolean keepCounter, Serializer<K> keySerializer, Serializer<V> valueSerializer){
    107107        checkNameNotExists(name);
    108         HTreeMap<K,V> ret = new HTreeMap<K,V>(engine, true,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, keySerializer, valueSerializer);
     108        HTreeMap<K,V> ret = new HTreeMap<>(engine, true,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, keySerializer, valueSerializer);
    109109        nameDir.put(name, ret.rootRecid);
    110110        collections.put(name, new WeakReference<Object>(ret));
     
    126126        if(recid!=null){
    127127            //open existing map
    128             HTreeMap<K,Object> m = new HTreeMap<K,Object>(engine, recid, defaultSerializer);
     128            HTreeMap<K,Object> m = new HTreeMap<>(engine, recid, defaultSerializer);
    129129            if(m.hasValues) throw new ClassCastException("Collection is Map, not Set");
    130130            ret = m.keySet();
    131131        }else{
    132132            //create new map
    133             HTreeMap<K,Object> m = new HTreeMap<K,Object>(engine, false,false, Utils.RANDOM.nextInt(), defaultSerializer, null, null);
     133            HTreeMap<K,Object> m = new HTreeMap<>(engine, false,false, Utils.RANDOM.nextInt(), defaultSerializer, null, null);
    134134            ret = m.keySet();
    135135            nameDir.put(name, m.rootRecid);
     
    151151    synchronized public <K> Set<K> createHashSet(String name, boolean keepCounter, Serializer<K> serializer){
    152152        checkNameNotExists(name);
    153         HTreeMap<K,Object> ret = new HTreeMap<K,Object>(engine, false,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, serializer, null);
     153        HTreeMap<K,Object> ret = new HTreeMap<>(engine, false,keepCounter,Utils.RANDOM.nextInt(), defaultSerializer, serializer, null);
    154154        nameDir.put(name, ret.rootRecid);
    155155        Set<K> ret2 = ret.keySet();
     
    177177        if(recid!=null){
    178178            //open existing map
    179             ret = new BTreeMap<K,V>(engine, recid,defaultSerializer);
     179            ret = new BTreeMap<>(engine, recid,defaultSerializer);
    180180            if(!ret.hasValues) throw new ClassCastException("Collection is Set, not Map");
    181181        }else{
    182182            //create new map
    183             ret = new BTreeMap<K,V>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, true, false,false, defaultSerializer, null, null, null);
     183            ret = new BTreeMap<>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE, true, false,false, defaultSerializer, null, null, null);
    184184            nameDir.put(name, ret.treeRecid);
    185185        }
     
    206206            BTreeKeySerializer<K> keySerializer, Serializer<V> valueSerializer, Comparator<K> comparator){
    207207        checkNameNotExists(name);
    208         BTreeMap<K,V> ret = new BTreeMap<K,V>(engine, nodeSize, true,valuesStoredOutsideNodes, keepCounter,defaultSerializer, keySerializer, valueSerializer, comparator);
     208        BTreeMap<K,V> ret = new BTreeMap<>(engine, nodeSize, true,valuesStoredOutsideNodes, keepCounter,defaultSerializer, keySerializer, valueSerializer, comparator);
    209209        nameDir.put(name, ret.treeRecid);
    210210        collections.put(name, new WeakReference<Object>(ret));
     
    236236        if(recid!=null){
    237237            //open existing map
    238             BTreeMap<K,Object> m = new BTreeMap<K,Object>(engine,  recid, defaultSerializer);
     238            BTreeMap<K,Object> m = new BTreeMap<>(engine,  recid, defaultSerializer);
    239239            if(m.hasValues) throw new ClassCastException("Collection is Map, not Set");
    240240            ret = m.keySet();
    241241        }else{
    242242            //create new map
    243             BTreeMap<K,Object> m =  new BTreeMap<K,Object>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE,
     243            BTreeMap<K,Object> m =  new BTreeMap<>(engine,BTreeMap.DEFAULT_MAX_NODE_SIZE,
    244244                    false, false,false, defaultSerializer, null, null, null);
    245245            nameDir.put(name, m.treeRecid);
     
    264264    synchronized public <K> NavigableSet<K> createTreeSet(String name,int nodeSize, boolean keepCounter, BTreeKeySerializer<K> serializer, Comparator<K> comparator){
    265265        checkNameNotExists(name);
    266         BTreeMap<K,Object> ret = new BTreeMap<K,Object>(engine, nodeSize, false, false, keepCounter, defaultSerializer, serializer, null, comparator);
     266        BTreeMap<K,Object> ret = new BTreeMap<>(engine, nodeSize, false, false, keepCounter, defaultSerializer, serializer, null, comparator);
    267267        nameDir.put(name, ret.treeRecid);
    268268        NavigableSet<K> ret2 = ret.keySet();
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/EngineWrapper.java

    r30532 r30737  
    228228        //TODO CAS
    229229
    230         final Queue<Record> records = new ConcurrentLinkedQueue<Record>();
     230        final Queue<Record> records = new ConcurrentLinkedQueue<>();
    231231
    232232
     
    337337            if(item!=null) item.check();
    338338            A ret = super.get(recid, serializer);
    339             if(ret!=null) items.put(recid, new Item<A>(serializer,ret));
     339            if(ret!=null) items.put(recid, new Item<>(serializer,ret));
    340340            return ret;
    341341        }
     
    344344        public <A> long put(A value, Serializer<A> serializer) {
    345345            long ret =  super.put(value, serializer);
    346             if(value!=null) items.put(ret, new Item<A>(serializer,value));
     346            if(value!=null) items.put(ret, new Item<>(serializer,value));
    347347            return ret;
    348348        }
     
    353353            if(item!=null) item.check();
    354354            super.update(recid, value, serializer);
    355             if(value!=null) items.put(recid, new Item<A>(serializer,value));
     355            if(value!=null) items.put(recid, new Item<>(serializer,value));
    356356        }
    357357
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/Fun.java

    r29363 r30737  
    4343
    4444    public static <A,B> Tuple2<A,B> t2(A a, B b) {
    45         return new Tuple2<A, B>(a,b);
     45        return new Tuple2<>(a,b);
    4646    }
    4747
    4848    public static <A,B,C> Tuple3<A,B,C> t3(A a, B b, C c) {
    49         return new Tuple3<A, B, C>((A)a, (B)b, (C)c);
     49        return new Tuple3<>((A)a, (B)b, (C)c);
    5050    }
    5151
    5252    public static <A,B,C,D> Tuple4<A,B,C,D> t4(A a, B b, C c, D d) {
    53         return new Tuple4<A, B, C, D>(a,b,c,d);
     53        return new Tuple4<>(a,b,c,d);
    5454    }
    5555
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/HTreeMap.java

    r29484 r30737  
    137137        @Override
    138138        public LinkedNode<K,V> deserialize(DataInput in, int available) throws IOException {
    139             return new LinkedNode<K, V>(
     139            return new LinkedNode<>(
    140140                    Utils.unpackLong(in),
    141141                    (K) keySerializer.deserialize(in,-1),
     
    294294        HashRoot r = engine.get(Engine.NAME_DIR_RECID, serializer);
    295295        if(r!=null)
    296             return new HTreeMap<String, Long>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);
     296            return new HTreeMap<>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);
    297297
    298298        if(engine.isReadOnly())
     
    310310        engine.update(Engine.NAME_DIR_RECID, r, serializer);
    311311        //and now load it
    312         return new HTreeMap<String, Long>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);
     312        return new HTreeMap<>(engine, Engine.NAME_DIR_RECID, Serializer.BASIC_SERIALIZER);
    313313
    314314    }
     
    482482                            //found, replace value at this node
    483483                            V oldVal = ln.value;
    484                             ln = new LinkedNode<K, V>(ln.next, ln.key, value);
     484                            ln = new LinkedNode<>(ln.next, ln.key, value);
    485485                            engine.update(recid, ln, LN_SERIALIZER);
    486486                            notify(key,  oldVal, value);
     
    503503                        int pos =(h >>>(7*(level-1) )) & 0x7F;
    504504                        nextDir[pos/8] = new long[8];
    505                         nextDir[pos/8][pos%8] = (engine.put(new LinkedNode<K, V>(0, key, value), LN_SERIALIZER) <<1) | 1;
     505                        nextDir[pos/8][pos%8] = (engine.put(new LinkedNode<>(0, key, value), LN_SERIALIZER) <<1) | 1;
    506506                    }
    507507
     
    514514                        int pos = (hash(n.key) >>>(7*(level -1) )) & 0x7F;
    515515                        if(nextDir[pos/8]==null) nextDir[pos/8] = new long[8];
    516                         n = new LinkedNode<K, V>(nextDir[pos/8][pos%8]>>>1, n.key, n.value);
     516                        n = new LinkedNode<>(nextDir[pos/8][pos%8]>>>1, n.key, n.value);
    517517                        nextDir[pos/8][pos%8] = (nodeRecid<<1) | 1;
    518518                        engine.update(nodeRecid, n, LN_SERIALIZER);
     
    530530                    // record does not exist in linked list, so create new one
    531531                    recid = dir[slot/8][slot%8]>>>1;
    532                     long newRecid = engine.put(new LinkedNode<K, V>(recid, key, value), LN_SERIALIZER);
     532                    long newRecid = engine.put(new LinkedNode<>(recid, key, value), LN_SERIALIZER);
    533533                    dir[slot/8][slot%8] = (newRecid<<1) | 1;
    534534                    engine.update(dirRecid, dir, DIR_SERIALIZER);
     
    601601                            }else{
    602602                                //referenced from LinkedNode
    603                                 prevLn = new LinkedNode<K, V>(ln.next, prevLn.key, prevLn.value);
     603                                prevLn = new LinkedNode<>(ln.next, prevLn.key, prevLn.value);
    604604                                engine.update(prevRecid, prevLn, LN_SERIALIZER);
    605605                            }
     
    11761176    public Map<K,V> snapshot(){
    11771177        Engine snapshot = SnapshotEngine.createSnapshotFor(engine);
    1178         return new HTreeMap<K, V>(snapshot,rootRecid, defaultSerialzierForSnapshots);
     1178        return new HTreeMap<>(snapshot,rootRecid, defaultSerialzierForSnapshots);
    11791179    }
    11801180
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/LongConcurrentHashMap.java

    r29363 r30737  
    386386                    oldValue = null;
    387387                    ++modCount;
    388                     tab[index] = new HashEntry<V>(key, hash, first, value);
     388                    tab[index] = new HashEntry<>(key, hash, first, value);
    389389                    count = c; // write-volatile
    390390                }
     
    448448                            int k = p.hash & sizeMask;
    449449                            HashEntry<V> n = newTable[k];
    450                             newTable[k] = new HashEntry<V>(p.key, p.hash,
     450                            newTable[k] = new HashEntry<>(p.key, p.hash,
    451451                                    n, p.value);
    452452                        }
     
    482482                        HashEntry<V> newFirst = e.next;
    483483                        for (HashEntry<V> p = first; p != e; p = p.next)
    484                             newFirst = new HashEntry<V>(p.key, p.hash,
     484                            newFirst = new HashEntry<>(p.key, p.hash,
    485485                                                          newFirst, p.value);
    486486                        tab[index] = newFirst;
     
    559559
    560560        for (int i = 0; i < this.segments.length; ++i)
    561             this.segments[i] = new Segment<V>(cap, loadFactor);
     561            this.segments[i] = new Segment<>(cap, loadFactor);
    562562    }
    563563
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/LongHashMap.java

    r29363 r30737  
    379379
    380380    Entry<V> createHashedEntry(long key, int index, int hash) {
    381         Entry<V> entry = new Entry<V>(key,hash);
     381        Entry<V> entry = new Entry<>(key,hash);
    382382        entry.next = elementData[index];
    383383        elementData[index] = entry;
     
    466466    @Override
    467467    public Iterator<V> valuesIterator() {
    468         return new ValueIterator<V>(this);
     468        return new ValueIterator<>(this);
    469469    }
    470470
    471471    @Override
    472472    public LongMapIterator<V> longMapIterator() {
    473         return new EntryIterator<V>(this);
     473        return new EntryIterator<>(this);
    474474    }
    475475
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/Queues.java

    r30532 r30737  
    4444            public Node<E> deserialize(DataInput in, int available) throws IOException {
    4545                if(available==0)return Node.EMPTY;
    46                 return new Node<E>(Utils.unpackLong(in), serializer.deserialize(in,-1));
     46                return new Node<>(Utils.unpackLong(in), serializer.deserialize(in,-1));
    4747            }
    4848        }
     
    5656            if(headRecid == 0) headRecid = engine.put(0L, Serializer.LONG_SERIALIZER);
    5757            head = new Atomic.Long(engine,headRecid);
    58             nodeSerializer = new NodeSerializer<E>(serializer);
     58            nodeSerializer = new NodeSerializer<>(serializer);
    5959        }
    6060
     
    246246        public boolean add(E e) {
    247247            long head2 = head.get();
    248             Node<E> n = new Node<E>(head2, e);
     248            Node<E> n = new Node<>(head2, e);
    249249            long recid = engine.put(n, nodeSerializer);
    250250            while(!head.compareAndSet(head2, recid)){
    251251                //failed to update head, so read new value and start over
    252252                head2 = head.get();
    253                 n = new Node<E>(head2, e);
     253                n = new Node<>(head2, e);
    254254                engine.update(recid, n, nodeSerializer);
    255255            }
     
    307307    static <E> Stack<E> getStack(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){
    308308        StackRoot root = engine.get(rootRecid, new StackRootSerializer(serializerSerializer));
    309         return new Stack<E>(engine, root.serializer, root.headerRecid, root.useLocks);
     309        return new Stack<>(engine, root.serializer, root.headerRecid, root.useLocks);
    310310    }
    311311
     
    330330        public boolean add(E item){
    331331            final long nextTail = engine.put((Node<E>)Node.EMPTY, nodeSerializer);
    332             Node<E> n = new Node<E>(nextTail, item);
     332            Node<E> n = new Node<>(nextTail, item);
    333333            long tail2 = tail.get();
    334334            while(!engine.compareAndSwap(tail2, (Node<E>)Node.EMPTY, n, nodeSerializer)){
     
    435435    static <E> Queue<E> getQueue(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){
    436436        QueueRoot root = engine.get(rootRecid, new QueueRootSerializer(serializerSerializer));
    437         return new Queue<E>(engine, root.serializer, root.headerRecid, root.nextTailRecid,root.sizeRecid);
     437        return new Queue<>(engine, root.serializer, root.headerRecid, root.nextTailRecid,root.sizeRecid);
    438438    }
    439439
     
    459459                long nRecid = headInsert.get();
    460460                Node<E> n = engine.get(nRecid, nodeSerializer);
    461                 n = new Node<E>(n.next, (E) o);
     461                n = new Node<>(n.next, (E) o);
    462462                engine.update(nRecid, n, nodeSerializer);
    463463                headInsert.set(n.next);
     
    579579    static <E> CircularQueue<E> getCircularQueue(Engine engine, Serializer<Serializer> serializerSerializer, long rootRecid){
    580580        CircularQueueRoot root = engine.get(rootRecid, new CircularQueueRootSerializer(serializerSerializer));
    581         return new CircularQueue<E>(engine, root.serializer, root.headerRecid, root.headerInsertRecid,root.sizeRecid);
     581        return new CircularQueue<>(engine, root.serializer, root.headerRecid, root.headerInsertRecid,root.sizeRecid);
    582582    }
    583583
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerBase.java

    r30532 r30737  
    13011301    private ArrayList<Object> deserializeArrayList(DataInput is, FastArrayList<Object> objectStack) throws IOException {
    13021302        int size = Utils.unpackInt(is);
    1303         ArrayList<Object> s = new ArrayList<Object>(size);
     1303        ArrayList<Object> s = new ArrayList<>(size);
    13041304        objectStack.add(s);
    13051305        for (int i = 0; i < size; i++) {
     
    13141314            throw new EOFException();
    13151315
    1316         ArrayList<Object> s = new ArrayList<Object>(size);
     1316        ArrayList<Object> s = new ArrayList<>(size);
    13171317        for (int i = 0; i < size; i++) {
    13181318            long l = Utils.unpackLong(is);
     
    13381338    private Vector<Object> deserializeVector(DataInput is, FastArrayList<Object> objectStack) throws IOException {
    13391339        int size = Utils.unpackInt(is);
    1340         Vector<Object> s = new Vector<Object>(size);
     1340        Vector<Object> s = new Vector<>(size);
    13411341        objectStack.add(s);
    13421342        for (int i = 0; i < size; i++)
     
    13481348    private HashSet<Object> deserializeHashSet(DataInput is, FastArrayList<Object> objectStack) throws IOException {
    13491349        int size = Utils.unpackInt(is);
    1350         HashSet<Object> s = new HashSet<Object>(size);
     1350        HashSet<Object> s = new HashSet<>(size);
    13511351        objectStack.add(s);
    13521352        for (int i = 0; i < size; i++)
     
    13581358    private LinkedHashSet<Object> deserializeLinkedHashSet(DataInput is, FastArrayList<Object> objectStack) throws IOException {
    13591359        int size = Utils.unpackInt(is);
    1360         LinkedHashSet<Object> s = new LinkedHashSet<Object>(size);
     1360        LinkedHashSet<Object> s = new LinkedHashSet<>(size);
    13611361        objectStack.add(s);
    13621362        for (int i = 0; i < size; i++)
     
    13681368    private TreeSet<Object> deserializeTreeSet(DataInput is, FastArrayList<Object> objectStack) throws IOException {
    13691369        int size = Utils.unpackInt(is);
    1370         TreeSet<Object> s = new TreeSet<Object>();
     1370        TreeSet<Object> s = new TreeSet<>();
    13711371        objectStack.add(s);
    13721372        Comparator comparator = (Comparator) deserialize(is, objectStack);
    13731373        if (comparator != null)
    1374             s = new TreeSet<Object>(comparator);
     1374            s = new TreeSet<>(comparator);
    13751375
    13761376        for (int i = 0; i < size; i++)
     
    13831383        int size = Utils.unpackInt(is);
    13841384
    1385         TreeMap<Object, Object> s = new TreeMap<Object, Object>();
     1385        TreeMap<Object, Object> s = new TreeMap<>();
    13861386        objectStack.add(s);
    13871387        Comparator comparator = (Comparator) deserialize(is, objectStack);
    13881388        if (comparator != null)
    1389             s = new TreeMap<Object, Object>(comparator);
     1389            s = new TreeMap<>(comparator);
    13901390        for (int i = 0; i < size; i++)
    13911391            s.put(deserialize(is, objectStack), deserialize(is, objectStack));
     
    13971397        int size = Utils.unpackInt(is);
    13981398
    1399         HashMap<Object, Object> s = new HashMap<Object, Object>(size);
     1399        HashMap<Object, Object> s = new HashMap<>(size);
    14001400        objectStack.add(s);
    14011401        for (int i = 0; i < size; i++)
     
    14071407        int size = Utils.unpackInt(is);
    14081408
    1409         IdentityHashMap<Object, Object> s = new IdentityHashMap<Object, Object>(size);
     1409        IdentityHashMap<Object, Object> s = new IdentityHashMap<>(size);
    14101410        objectStack.add(s);
    14111411        for (int i = 0; i < size; i++)
     
    14171417        int size = Utils.unpackInt(is);
    14181418
    1419         LinkedHashMap<Object, Object> s = new LinkedHashMap<Object, Object>(size);
     1419        LinkedHashMap<Object, Object> s = new LinkedHashMap<>(size);
    14201420        objectStack.add(s);
    14211421        for (int i = 0; i < size; i++)
     
    14281428        int size = Utils.unpackInt(is);
    14291429
    1430         Hashtable<Object, Object> s = new Hashtable<Object, Object>(size);
     1430        Hashtable<Object, Object> s = new Hashtable<>(size);
    14311431        objectStack.add(s);
    14321432        for (int i = 0; i < size; i++)
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/SerializerPojo.java

    r30532 r30737  
    5959        @Override
    6060                public CopyOnWriteArrayList<ClassInfo> deserialize(DataInput in, int available) throws IOException{
    61             if(available==0) return new CopyOnWriteArrayList<ClassInfo>();
     61            if(available==0) return new CopyOnWriteArrayList<>();
    6262
    6363            int size = Utils.unpackInt(in);
    64             ArrayList<ClassInfo> ret = new ArrayList<ClassInfo>(size);
     64            ArrayList<ClassInfo> ret = new ArrayList<>(size);
    6565
    6666            for (int i = 0; i < size; i++) {
     
    7676                ret.add(new ClassInfo(className, fields,isEnum,isExternalizable));
    7777            }
    78             return new CopyOnWriteArrayList<ClassInfo>(ret);
     78            return new CopyOnWriteArrayList<>(ret);
    7979        }
    8080    };
     
    9595    public SerializerPojo(CopyOnWriteArrayList<ClassInfo> registered){
    9696        if(registered == null)
    97             this.registered = new CopyOnWriteArrayList<ClassInfo>();
     97            this.registered = new CopyOnWriteArrayList<>();
    9898        else
    9999            this.registered = registered;
     
    107107
    108108        private final String name;
    109         private final List<FieldInfo> fields = new ArrayList<FieldInfo>();
    110         private final Map<String, FieldInfo> name2fieldInfo = new HashMap<String, FieldInfo>();
    111         private final Map<String, Integer> name2fieldId = new HashMap<String, Integer>();
     109        private final List<FieldInfo> fields = new ArrayList<>();
     110        private final Map<String, FieldInfo> name2fieldInfo = new HashMap<>();
     111        private final Map<String, Integer> name2fieldId = new HashMap<>();
    112112        private ObjectStreamField[] objectStreamFields;
    113113
     
    290290
    291291    CopyOnWriteArrayList<ClassInfo> registered;
    292     Map<Class<?>, Integer> class2classId = new HashMap<Class<?>, Integer>();
    293     Map<Integer, Class<?>> classId2class = new HashMap<Integer, Class<?>>();
     292    Map<Class<?>, Integer> class2classId = new HashMap<>();
     293    Map<Integer, Class<?>> classId2class = new HashMap<>();
    294294
    295295
     
    333333        if (fields == null) {
    334334            ObjectStreamClass streamClass = ObjectStreamClass.lookup(clazz);
    335             FastArrayList<ObjectStreamField> fieldsList = new FastArrayList<ObjectStreamField>();
     335            FastArrayList<ObjectStreamField> fieldsList = new FastArrayList<>();
    336336            while (streamClass != null) {
    337337                for (ObjectStreamField f : streamClass.getFields()) {
     
    567567
    568568
    569     private static Map<Class<?>, Constructor<?>> class2constuctor = new ConcurrentHashMap<Class<?>, Constructor<?>>();
     569    private static Map<Class<?>, Constructor<?>> class2constuctor = new ConcurrentHashMap<>();
    570570
    571571    /**
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/SnapshotEngine.java

    r30532 r30737  
    2222
    2323
    24     protected final Map<Snapshot, String> snapshots = new ConcurrentHashMap<Snapshot, String>();
     24    protected final Map<Snapshot, String> snapshots = new ConcurrentHashMap<>();
    2525
    2626
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/StoreAppend.java

    r29484 r30737  
    44import java.io.IOError;
    55import java.io.IOException;
    6 import java.util.BitSet;
    76import java.util.concurrent.locks.Lock;
    87import java.util.concurrent.locks.ReentrantLock;
     
    3736    volatile protected long maxRecid;
    3837
    39     protected LongConcurrentHashMap<Volume> volumes = new LongConcurrentHashMap<Volume>();
    40     protected final LongConcurrentHashMap<Long> recidsInTx = new LongConcurrentHashMap<Long>();
     38    protected LongConcurrentHashMap<Volume> volumes = new LongConcurrentHashMap<>();
     39    protected final LongConcurrentHashMap<Long> recidsInTx = new LongConcurrentHashMap<>();
    4140
    4241
     
    8584
    8685            //replay file and rebuild recid index table
    87             LongHashMap<Long> recidsTable2 = new LongHashMap<Long>();
     86            LongHashMap<Long> recidsTable2 = new LongHashMap<>();
    8887            if(!currentVolume.isEmpty()){
    8988                currentFileOffset =0;
     
    405404            if(!recidsInTx.isEmpty()) throw new IllegalAccessError("Uncommited changes");
    406405
    407             LongHashMap<Boolean> ff = new LongHashMap<Boolean>();
     406            LongHashMap<Boolean> ff = new LongHashMap<>();
    408407            for(long recid=0;recid<maxRecid;recid++){
    409408                long indexVal = recidsTable.getLong(recid*8);
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/StoreWAL.java

    r29484 r30737  
    33import java.io.IOError;
    44import java.io.IOException;
    5 import java.util.concurrent.locks.Lock;
    6 import java.util.concurrent.locks.ReentrantReadWriteLock;
    75
    86/**
     
    3129    protected long logSize;
    3230
    33     protected final LongConcurrentHashMap<long[]> modified = new LongConcurrentHashMap<long[]>();
     31    protected final LongConcurrentHashMap<long[]> modified = new LongConcurrentHashMap<>();
    3432
    3533
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/TxMaker.java

    r30532 r30737  
    1818    protected final Object lock = new Object();
    1919
    20     protected final LongMap<TxEngine> globalMod = new LongHashMap<TxEngine>();
     20    protected final LongMap<TxEngine> globalMod = new LongHashMap<>();
    2121
    2222
     
    5959
    6060        protected LongMap<Fun.Tuple2<?, Serializer>> modItems =
    61                 new LongHashMap<Fun.Tuple2<?, Serializer>>();
     61                new LongHashMap<>();
    6262
    63         protected Set<Long> newItems = new LinkedHashSet<Long>();
     63        protected Set<Long> newItems = new LinkedHashSet<>();
    6464
    6565        protected TxEngine(Engine engine) {
  • applications/editors/josm/plugins/imagerycache/src/org/mapdb/Volume.java

    r29484 r30737  
    2828import java.util.Map;
    2929import java.util.WeakHashMap;
    30 import java.util.concurrent.ExecutionException;
    31 import java.util.concurrent.Future;
    3230import java.util.concurrent.locks.ReentrantLock;
    3331import java.util.logging.Level;
  • applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/DBTile.java

    r30135 r30737  
    1616        data = dbTile.data.clone();
    1717        if (dbTile.metaData != null) {
    18             metaData = new HashMap<String, String>(dbTile.metaData);
     18            metaData = new HashMap<>(dbTile.metaData);
    1919        } else {
    20             metaData = new HashMap<String, String>();
     20            metaData = new HashMap<>();
    2121        }
    2222        lastModified = dbTile.lastModified;
  • applications/editors/josm/plugins/imagerycache/src/org/openstreetmap/josm/plugins/imagerycache/TileDAOMapDB.java

    r29946 r30737  
    1919    public static boolean dbNotAvailable = false;
    2020
    21     protected HashMap<String, DB> dbs = new HashMap<String, DB>();
    22     protected HashMap<String, Map<Long, DBTile>> storages = new HashMap<String, Map<Long, DBTile>>();
     21    protected HashMap<String, DB> dbs = new HashMap<>();
     22    protected HashMap<String, Map<Long, DBTile>> storages = new HashMap<>();
    2323    private File cacheFolder;
    2424   
Note: See TracChangeset for help on using the changeset viewer.