Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B4ECE73E5 for ; Wed, 28 Sep 2011 23:48:52 +0000 (UTC) Received: (qmail 39389 invoked by uid 500); 28 Sep 2011 23:48:52 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 39289 invoked by uid 500); 28 Sep 2011 23:48:52 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 39278 invoked by uid 99); 28 Sep 2011 23:48:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 23:48:52 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of gudnabrsam@gmail.com designates 209.85.220.171 as permitted sender) Received: from [209.85.220.171] (HELO mail-vx0-f171.google.com) (209.85.220.171) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2011 23:48:44 +0000 Received: by vcbfo13 with SMTP id fo13so40047vcb.30 for ; Wed, 28 Sep 2011 16:48:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; bh=RK3KkCqb7Pfxx+lpe2h/cmg32B0t2+Oi5OZev40tCZ8=; b=skaJqesKs7XMfxFztvYPfdd6TLO9+u4Ps2JsVQKz0C3raphZmDZZaCF7gl/FE1V0m0 lDUKAb+Ck4BFQJ7sQhdyrEFs29iBuaKMrvnKwGE1VKqpUUObKLO2r80GLGubV5yEfWvw cYeaZUnuR5IrW8KFmLJjNwvMDeeotGZ6NGqyw= MIME-Version: 1.0 Received: by 10.52.89.80 with SMTP id bm16mr9074818vdb.525.1317253703598; Wed, 28 Sep 2011 16:48:23 -0700 (PDT) Received: by 10.52.184.197 with HTTP; Wed, 28 Sep 2011 16:48:23 -0700 (PDT) Reply-To: gudnabrsam@gmail.com In-Reply-To: <4E83AB9D.8020209@zeus.net.au> References: <4E83A8AF.4050506@zeus.net.au> <4E83AB9D.8020209@zeus.net.au> Date: Wed, 28 Sep 2011 18:48:23 -0500 Message-ID: Subject: Re: [collections] Reference Collection Utilities From: Matt Benson To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Wed, Sep 28, 2011 at 6:19 PM, Peter Firmstone wrote: > I've just realised the code probably isn't a good fit with commons > collections, primarily because it utilises Generics. There is a branch that supports generics, just not enough love to finish it for a release. Matt > > On 29/09/2011 9:07 AM, Peter Firmstone wrote: >> >> These reference collection utilities don't really belong in our project, >> but they do assist to solve some fundamental problems using references i= n >> collections, the implementation is abstracted so it can be utilised for = any >> valid Collections Framework Interface implementation, allowing the user = to >> use any of the Java Collections Framework classes with any mix of weak, = weak >> identity, soft, soft identity or strong references, while keeping the >> references abstracted out of the collections api under the covers. =A0Wh= ile >> not directly focused on Concurrency problems, it is intended to be used = with >> concurrent code. >> >> If you guys want to take it over and improve it, provided you think it >> might be of some use, or just give it some peer review and suggest >> improvements, that would certainly benefit us. >> >> See below for more info. >> >> P.S. can you cc me in your reply? =A0I'm not subscribed to commons dev. >> >> Regards, >> >> Peter. >> >> -------- Original Message -------- >> Subject: =A0 =A0 Re: New Collection Utilities. >> Date: =A0 =A0 Mon, 26 Sep 2011 10:24:16 -0500 >> From: =A0 =A0 Gregg Wonderly >> To: =A0 =A0 Peter Firmstone >> >> >> >> You might think about announcing this on the concurrency list to see if >> you can >> elicit any thoughts on their interest in it, as well as more eyes that >> might be >> able to point out anything that could be even better on concurrency >> control. >> >> Gregg >> >> On 9/26/2011 2:52 AM, Peter Firmstone wrote: >> > =A0The new reference collection utilities I've just committed, probabl= y >> > appear a >> > =A0little daunting, so many classes... >> > >> > =A0Anyway, all the client needs are these two, the rest is private >> > implementation. >> > =A0It has an extremely compact API. >> > >> > =A0org.apache.river.impl.util.RC - Stands for ReferenceCollection, >> > contains static >> > =A0methods. >> > =A0org.apache.river.impl.util.Ref - An enum parameter, allows the >> > developer to >> > =A0select the desired reference type. >> > >> > =A0RC provides static methods to encapsulate Collections containing >> > references >> > =A0behind facades handling reference creation, calls to get, removal a= nd >> > garbage >> > =A0collecting of References. >> > >> > =A0All Java Collection Framework interfaces are implemented fully, rig= ht >> > down to >> > =A0the correct equals behaviour for Set, List and Map, and Map.Entry a= nd >> > Set's of >> > =A0Entry's. Even the reference classes themselves are overridden (alth= ough >> > package >> > =A0private) to implement the correct equals and hashcode behaviour. It= 's >> > all been >> > =A0tested with unit tests. >> > >> > =A0Two Sets, one utilising Weak References and any other Set containin= g >> > the same >> > =A0objects will be equal as per the Set interface requirement, no matt= er >> > what >> > =A0reference types are utilised, the same goes for List's, Maps, >> > NavigableMap, >> > =A0SortedMap, SortedSet, ConcurrentMap, ConcurrentNavigableMap and all= the >> > other >> > =A0JCF interfaces you can think of. >> > >> > =A0All views remain referenced, so their referents don't inadvertantly >> > become >> > =A0strongly referenced. Only the developers calling classes will make = the >> > referents >> > =A0strongly referenced upon retrieval. >> > >> > =A0Synchronization must be performed by the internal collection passed= in >> > by the >> > =A0developer, it can't be performed externally - garbage collection ca= uses >> > =A0mutation. To assist concurrency there's a third class with static >> > methods >> > =A0org.apache.river.impl.utils.ConcurrentCollections to provide >> > synchronization >> > =A0wrappers (multi read, single write) similar to wrapper classes prov= ided >> > in >> > =A0java.util.Collections >> > >> > =A0The RC class makes it extremely simple to create Reference based >> > Collections: >> > >> > =A0Set =A0strings =3D RC.set(new TreeSet>(), >> > Ref.SOFT); >> > >> > =A0Static methods were chosen over constructors because they're easier= to >> > read (not >> > =A0filled with generics) and make the API appear much smaller, you onl= y >> > need two >> > =A0new classes and don't need to know the implementation details. >> > >> > =A0Yes it supports Comparator's too: >> > >> > =A0ConcurrentNavigableMap =A0instance; >> > =A0Comparator =A0comparator; >> > >> > =A0// A simple comparator - demonstration purposes only. >> > =A0comparator =3D new Comparator(){ >> > >> > =A0@Override >> > =A0public int compare(Integer o1, Integer o2) { >> > =A0return o1.compareTo(o2); >> > =A0} >> > >> > =A0}; >> > >> > =A0Comparator> =A0ci =3D RC.comparator(comparator); >> > >> > =A0ConcurrentNavigableMap, Reference> =A0in= ternal >> > =A0=3D new ConcurrentSkipListMap, Reference= >(ci); >> > >> > =A0instance =3D RC.concurrentNavigableMap(internal, Ref.WEAK, Ref.STRO= NG); >> > >> > >> > =A0The developer gets to choose the collection implementation and the >> > reference >> > =A0types, all the hard work's done. I hope you find these reference >> > utilities as >> > =A0useful as I have. >> > >> > =A0N.B. I'll create a jar archive for them and merge this back into th= e >> > main trunk, >> > =A0after peer review. >> > >> > =A0Check it out from svn: >> > >> > >> > =A0https://svn.apache.org/repos/asf/river/jtsk/skunk/peterConcurrentPo= licy/ >> > >> > =A0Or browse at: >> > >> > =A0http://svn.apache.org/viewvc/river/jtsk/skunk/peterConcurrentPolicy= / >> > >> > =A0/* >> > =A0* Licensed to the Apache Software Foundation (ASF) under one >> > =A0* or more contributor license agreements. See the NOTICE file >> > =A0* distributed with this work for additional information >> > =A0* regarding copyright ownership. The ASF licenses this file >> > =A0* to you under the Apache License, Version 2.0 (the >> > =A0* "License"); you may not use this file except in compliance >> > =A0* with the License. You may obtain a copy of the License at >> > =A0* >> > =A0*http://www.apache.org/licenses/LICENSE-2.0 >> > =A0* >> > =A0* Unless required by applicable law or agreed to in writing, softwa= re >> > =A0* distributed under the License is distributed on an "AS IS" BASIS, >> > =A0* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >> > implied. >> > =A0* See the License for the specific language governing permissions a= nd >> > =A0* limitations under the License. >> > =A0*/ >> > >> > =A0package org.apache.river.impl.util; >> > >> > =A0/** >> > =A0* Ref enum represents the types of references provided by the jvm, = it >> > also >> > =A0* defines equals contract behaviour for Reference implementations >> > suitable >> > =A0* for use in Collections. >> > =A0* >> > =A0* It is recommended to use STRONG or IDENTITY based references as k= eys >> > =A0* in Maps, due to the unpredictability that occurs, when an equal >> > =A0* Reference Key disappears due to garbage collection. >> > =A0* >> > =A0* Map implementations must delete their key -> =A0value mapping whe= n >> > either the >> > =A0* key or value References become unreachable. >> > =A0* >> > =A0* Object.toString() is overridden in the reference implementations = to >> > return >> > =A0* toString() of the referent, if it is still reachable, otherwise t= he >> > reference >> > =A0* calls their superclass toString() method, where superclass is a j= ava >> > =A0* Reference subclass. >> > =A0* >> > =A0* Phantom references are not used, they are designed to replace >> > =A0* {@link Object#finalize() } and remain unreachable, but not garbag= e >> > collected >> > =A0until >> > =A0* the {@link PhantomReference} also becomes unreachable, get() alwa= ys >> > returns >> > =A0* null. >> > =A0* >> > =A0* @see Reference >> > =A0* @see WeakReference >> > =A0* @see SoftReference >> > =A0* @see PhantomReference >> > =A0* @see Map >> > =A0* @see ConcurrentMap >> > =A0* @see List >> > =A0* @see Set >> > =A0* @see Collection >> > =A0* @see Comparable >> > =A0* @author Peter Firmstone. >> > =A0*/ >> > =A0public enum Ref { >> > =A0/** >> > =A0* SOFT References implement equals based on equality of the referen= t >> > =A0* objects, while the referent is still reachable. The hashCode >> > =A0* implementation is based on the referent implementation of hashCod= e, >> > =A0* while the referent is reachable. >> > =A0* >> > =A0* After garbage collection, Reference equality is based >> > =A0* on the original identity of the referents using >> > System.identityHashCode(). >> > =A0* >> > =A0* Because {@link System#identityHashCode(java.lang.Object)} is not >> > unique, >> > =A0* the referents Class.hashCode() is also used to calculate the >> > hashCode, >> > =A0* generated during Reference construction. >> > =A0* >> > =A0* SOFT References implement Comparable allowing the referent Object= s >> > =A0* to be compared if they implement Comparable. If the referent Obje= ct >> > =A0* doesn't implement Comparable, the hashCode's of the Reference is >> > =A0* compared instead. If the referent Objects don't implement Compara= ble, >> > =A0* then they shouldn't really be used in sorted collections. >> > =A0* >> > =A0* Garbage collection must be the same as SoftReference. >> > =A0* @see SoftReference >> > =A0* @see WeakReference >> > =A0* @see Comparable >> > =A0*/ >> > =A0SOFT, >> > =A0/** >> > =A0* SOFT_IDENTY References implement equals based on identity =3D=3D = of the >> > =A0* referent objects. >> > =A0* >> > =A0* Garbage collection must be the same as SoftReference. >> > =A0* @see SoftReference >> > =A0*/ >> > =A0SOFT_IDENTITY, >> > =A0/** >> > =A0* WEAK References implement equals based on equality of the referen= t >> > =A0* objects, while the referent is still reachable. The hashCode >> > =A0* implementation is based on the referent implementation of hashCod= e, >> > =A0* while the referent is reachable. >> > =A0* >> > =A0* After garbage collection, Reference equality is based >> > =A0* on the original identity of the referents using >> > System.identityHashCode(). >> > =A0* >> > =A0* Because System.identityHashCode() is not unique, the referents >> > =A0* Class.hashCode() is also used to calculate the hashCode, generate= d >> > during >> > =A0* Reference construction. >> > =A0* >> > =A0* WEAK References implement comparable allowing the referent Object= s >> > =A0* to be compared if they implement Comparable. If the referent Obje= ct >> > =A0* doesn't implement Comparable, the hashCode's of the Reference is >> > =A0* compared instead. If the referent Object's don't implement >> > Comparable, >> > =A0* then they shouldn't really be used in sorted collections. >> > =A0* >> > =A0* Garbage collection must be the same as WeakReference. >> > =A0* @see WeakReference >> > =A0* @see Comparable >> > =A0*/ >> > =A0WEAK, >> > =A0/** >> > =A0* WEAK_IDENTY References implement equals based on identity =3D=3D = of the >> > =A0* referent objects. >> > =A0* >> > =A0* Garbage collection must be the same as WeakReference. >> > =A0* >> > =A0* @see WeakReference >> > =A0*/ >> > =A0WEAK_IDENTITY, >> > =A0/** >> > =A0* STRONG References implement equals and hashCode() based on the >> > =A0* equality of the underlying Object. >> > =A0* >> > =A0* STRONG References implement Comparable allowing the referent Obje= cts >> > =A0* to be compared if they implement Comparable. If the referent Obje= ct >> > =A0* doesn't implement Comparable, the hashCode's of the Reference is >> > =A0* compared instead. If the referent Object's don't implement >> > Comparable, >> > =A0* then they shouldn't really be used in sorted collections. >> > =A0* >> > =A0* Garbage collection doesn't occur until the Reference is cleared. >> > =A0* @see Comparable >> > =A0*/ >> > =A0STRONG >> > =A0} >> > >> > >> > =A0/* >> > =A0* Licensed to the Apache Software Foundation (ASF) under one >> > =A0* or more contributor license agreements. See the NOTICE file >> > =A0* distributed with this work for additional information >> > =A0* regarding copyright ownership. The ASF licenses this file >> > =A0* to you under the Apache License, Version 2.0 (the >> > =A0* "License"); you may not use this file except in compliance >> > =A0* with the License. You may obtain a copy of the License at >> > =A0* >> > =A0*http://www.apache.org/licenses/LICENSE-2.0 >> > =A0* >> > =A0* Unless required by applicable law or agreed to in writing, softwa= re >> > =A0* distributed under the License is distributed on an "AS IS" BASIS, >> > =A0* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >> > implied. >> > =A0* See the License for the specific language governing permissions a= nd >> > =A0* limitations under the License. >> > =A0*/ >> > >> > =A0package org.apache.river.impl.util; >> > >> > =A0import java.lang.ref.Reference; >> > =A0import java.lang.Comparable; >> > =A0import java.util.Collection; >> > =A0import java.util.Collections; >> > =A0import java.util.Comparator; >> > =A0import java.util.Deque; >> > =A0import java.util.List; >> > =A0import java.util.Map; >> > =A0import java.util.Map.Entry; >> > =A0import java.util.ListIterator; >> > =A0import java.util.NavigableMap; >> > =A0import java.util.NavigableSet; >> > =A0import java.util.Queue; >> > =A0import java.util.Set; >> > =A0import java.util.SortedMap; >> > =A0import java.util.SortedSet; >> > =A0import java.util.concurrent.BlockingDeque; >> > =A0import java.util.concurrent.BlockingQueue; >> > =A0import java.util.concurrent.ConcurrentMap; >> > =A0import java.util.concurrent.ConcurrentNavigableMap; >> > >> > =A0/** >> > =A0*

>> > =A0* This class contains a number of static methods for using and >> > abstracting >> > =A0* References in Collections. Interfaces from the Java Collections >> > Framework >> > =A0* are supported. >> > =A0*

>> > =A0* Referents in these collections may implement {@link Comparable} o= r >> > =A0* a {@link Comparator} may be used for sorting. When Comparator's a= re >> > utilised, >> > =A0* they must first be encapsulated {@link >> > RC#comparator(java.util.Comparator) }, >> > =A0* before passing to a constructor for your preferred underlying >> > Collection >> > =A0* implementation. >> > =A0*

>> > =A0* {@link Comparable} is not supported for IDENTITY =3D=3D reference= d >> > Collections, >> > =A0* in this case a Comparator must be used. >> > =A0*

>> > =A0* All other references support {@link Comparable}, if the referent >> > Object >> > =A0* doesn't implement {@link Comparable}, then {@link >> > Reference#hashCode()} is used >> > =A0* for sorting. If two referent Objects have identical hashCodes, >> > =A0* but are unequal and do not implement {@link Comparable}, their >> > references >> > =A0* will also have identical hashCodes, so only one of the referents = can >> > =A0* be added to a {@link SortedSet} or {@link SortedMap}. This can be >> > fixed by >> > =A0using a >> > =A0* {@link Comparator}. >> > =A0*

>> > =A0* For all intents and purposes these utilities behave the same as y= our >> > preferred >> > =A0* underlying {@link Collection} implementation, with the exception = of >> > =A0* {@link Reference} reachability. An Object or Key,Value entry is >> > removed >> > =A0* from a {@link Collection} or {@link Map}, upon becoming eligible = for >> > =A0* garbage collection. >> > =A0*

>> > =A0* Synchronisation must be implemented by your preferred {@link >> > Collection} >> > =A0* and cannot be performed externally to the returned {@link >> > Collection}. >> > =A0* Your chosen underlying {@link Collection} must also be mutable. >> > =A0* Objects will be removed automatically from underlying Collections >> > when >> > =A0* they are eligible for garbage collection, this breaks external >> > synchronisation. >> > =A0* {@link >> > CollectionsConcurrent#multiReadCollection(java.util.Collection)} may >> > =A0* be useful for synchronising your chosen underlying {@link >> > Collection}, >> > =A0* especially if Objects are not being garbage collected often and >> > writes >> > =A0* are minimal. >> > =A0*

>> > =A0* An Unmodifiable wrapper {@link >> > =A0Collections#unmodifiableCollection(java.util.Collection)} >> > =A0* may be used externally to prevent additions to the underlying >> > Collections, >> > =A0* referents will still be removed as they become unreachable howeve= r. >> > =A0*

>> > =A0* Note that any Sub List, Sub Set or Sub Map obtained by any of the >> > Java >> > =A0* Collections Framework interfaces, must be views of the underlying >> > =A0* Collection, if the Collection uses defensive copies instead of vi= ews, >> > =A0* References could potentially remain in one copy after garbage >> > collection, >> > =A0* causing null returns. If using standard Java Collections Framewor= k >> > =A0* implementations, these problems don't occur as all Sub Lists, >> > =A0* Sub Sets or Sub Maps are views only. >> > =A0*

>> > =A0* {@link Map#entrySet() } view instances returned preserve your cho= sen >> > reference >> > =A0* behaviour, they even support {@link Set#add(java.lang.Object)} or >> > =A0* {@link Set#addAll(java.util.Collection)} methods, although you'll= be >> > hard >> > =A0* pressed to find a standard java implementation that does. If you = have >> > a >> > =A0* Map with a Set of Entry's implementing add, the implementation wi= ll >> > need a >> > =A0* Comparator, that compares Entry's only by their keys, to avoid >> > duplicating >> > =A0* keys, primarily because an Entry hashCode includes the both key a= nd >> > value in its >> > =A0* calculation. {@link Entry#hashCode() } >> > =A0*

>> > =A0* All other {@link Map#entrySet() } methods are fully implemented a= nd >> > supported. >> > =A0*

>> > =A0* {@link Entry} view instances returned by these methods preserve >> > reference >> > =A0* behaviour, all methods are fully implemented and supported. >> > =A0*

>> > =A0* {@link Set} and it's sub interfaces {@link SortedSet} and >> > =A0* {@link NavigableSet}, return views that preserve reference behavi= our, >> > =A0* all methods are fully implemented and supported. >> > =A0*

>> > =A0* {@link Map} and it's sub interfaces {@link SortedMap}, {@link >> > NavigableMap}, >> > =A0* {@link ConcurrentMap} and {@link ConcurrentNavigableMap} return >> > =A0* views that preserve reference behaviour, all methods are fully >> > implemented >> > =A0* and supported. >> > =A0*

>> > =A0* {@link List} returns views that preserve reference behaviour, all >> > methods are >> > =A0* fully implemented and supported. >> > =A0*

>> > =A0* {@link Queue} and it's sub interfaces {@link Deque}, {@link >> > BlockingQueue} and >> > =A0* {@link BlockingDeque} return views that preserve reference behavi= our, >> > =A0* all methods are fully implemented and supported. >> > =A0*

>> > =A0* {@link Iterator} and {@link ListIterator} views preserve referenc= e >> > behaviour, >> > =A0all methods >> > =A0* are fully implemented and supported. >> > =A0*

>> > =A0* RC stands for Reference Collection and is abbreviated due to the >> > length of >> > =A0* generic parameter arguments typically required. >> > =A0*

>> > =A0* @see Ref >> > =A0* @see Reference >> > =A0* @author Peter Firmstone. >> > =A0*/ >> > =A0public class RC { >> > =A0private RC(){} // Non instantiable >> > >> > =A0/** >> > =A0* When using a Comparator in SortedSet's and SortedMap's, the >> > Comparator >> > =A0* must be encapsulated using this method, to order the Set or Map >> > =A0* by referents and not References. >> > =A0* >> > =A0* @param >> > =A0* @param comparator >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Comparator> =A0comparator(Comparat= or> > super T> >> > =A0comparator){ >> > =A0return new ReferenceComparator(comparator); >> > =A0} >> > >> > =A0/** >> > =A0* Wrap a Collection for holding references so it appears as a >> > Collection >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Collection =A0collection(Collection> >> > =A0internal, >> > =A0Ref type){ >> > =A0return new ReferenceCollection(internal, type); >> > =A0} >> > >> > =A0/** >> > =A0* Wrap a List for holding references so it appears as a List >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0List =A0list(List> =A0internal,= Ref >> > type){ >> > =A0return new ReferenceList(internal, type); >> > =A0} >> > >> > =A0/** >> > =A0* Wrap a Set for holding references so it appears as a Set >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Set =A0set(Set> =A0internal, Re= f type){ >> > =A0return new ReferenceSet(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a SortedSet for holding references so it appears as a Sorted= Set >> > =A0* containing referents. >> > =A0* >> > =A0* @para m >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0SortedSet =A0sortedSet( >> > =A0SortedSet> =A0internal, Ref type){ >> > =A0return new ReferenceSortedSet(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a NavigableSet for holding references so it appears as a >> > NavigableSet >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0NavigableSet =A0navigableSet( >> > =A0NavigableSet> =A0internal, Ref type){ >> > =A0return new ReferenceNavigableSet(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a Queue for holding references so it appears as a Queue >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Queue =A0queue(Queue> =A0intern= al, Ref >> > type){ >> > =A0return new ReferencedQueue(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a Deque for holding references so it appears as a Deque >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Deque =A0deque(Deque> =A0intern= al, Ref >> > type){ >> > =A0return new ReferenceDeque(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a BlockingQueue for holding references so it appears as a >> > BlockingQueue >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0BlockingQueue =A0blockingQueue( >> > =A0BlockingQueue> =A0internal, Ref type){ >> > =A0return new ReferenceBlockingQueue(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a BlockingDeque for holding references so it appears as a >> > BlockingDeque >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param internal >> > =A0* @param type >> > =A0* @return >> > =A0*/ >> > =A0public static =A0BlockingDeque =A0blockingDeque( >> > =A0BlockingDeque> =A0internal, Ref type){ >> > =A0return new ReferenceBlockingDeque(internal, type); >> > =A0} >> > =A0/** >> > =A0* Wrap a Map for holding references so it appears as a Map >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param >> > =A0* @param internal >> > =A0* @param key >> > =A0* @param value >> > =A0* @return >> > =A0*/ >> > =A0public static =A0Map =A0map( >> > =A0Map, Reference> =A0internal, Ref key, Ref value){ >> > =A0return new ReferenceMap(internal, key, value); >> > =A0} >> > =A0/** >> > =A0* Wrap a SortedMap for holding references so it appears as a Sorted= Map >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param >> > =A0* @param internal >> > =A0* @param key >> > =A0* @param value >> > =A0* @return >> > =A0*/ >> > =A0public static =A0SortedMap =A0sortedMap( >> > =A0SortedMap, Reference> =A0internal, Ref key, Ref val= ue){ >> > =A0return new ReferenceSortedMap(internal, key, value); >> > =A0} >> > =A0/** >> > =A0* Wrap a NavigableMap for holding references so it appears as a >> > NavigableMap >> > =A0* containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param >> > =A0* @param internal >> > =A0* @param key >> > =A0* @param value >> > =A0* @return >> > =A0*/ >> > =A0public static =A0NavigableMap =A0navigableMap( >> > =A0NavigableMap, Reference> =A0internal, Ref key, Ref >> > value){ >> > =A0return new ReferenceNavigableMap(internal, key, value); >> > =A0} >> > =A0/** >> > =A0* Wrap a ConcurrentMap for holding references so it appears as a >> > ConcurrentMap >> > =A0* containing referents. >> > =A0* >> > =A0* @param =A0- key type. >> > =A0* @param =A0- value type. >> > =A0* @param internal - for holding references. >> > =A0* @param key - key reference type. >> > =A0* @param value - value reference type. >> > =A0* @return >> > =A0*/ >> > =A0public static =A0ConcurrentMap =A0concurrentMap( >> > =A0ConcurrentMap, Reference> =A0internal, Ref key, Ref >> > value){ >> > =A0return new ReferenceConcurrentMap(internal, key, value); >> > =A0} >> > >> > =A0/** >> > =A0* Wrap a ConcurrentNavigableMap for holding references so it appear= s as >> > a >> > =A0* ConcurrentNavigableMap containing referents. >> > =A0* >> > =A0* @param >> > =A0* @param >> > =A0* @param internal >> > =A0* @param key >> > =A0* @param value >> > =A0* @return >> > =A0*/ >> > =A0public static =A0ConcurrentNavigableMap >> > =A0concurrentNavigableMap( >> > =A0ConcurrentNavigableMap, Reference> =A0internal, Ref= key, >> > Ref value){ >> > =A0return new ReferenceConcurrentNavigableMap(internal, key, val= ue); >> > =A0} >> > =A0} >> > >> > >> > >> > >> > >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org > For additional commands, e-mail: dev-help@commons.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org