예제 #1
0
 public bool retainAll(java.util.Collection <Object> o)
 {
     if (root.fast)
     {
         lock (root)
         {
             java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)root.list.clone();
             java.util.List <Object>      sub  = get(temp);
             bool r = sub.retainAll(o);
             if (r)
             {
                 last = first + sub.size();
             }
             root.list = temp;
             expected  = temp;
             return(r);
         }
     }
     else
     {
         lock (root.list)
         {
             return(get(expected).retainAll(o));
         }
     }
 }
예제 #2
0
        /**
         * Factory method to create an ordered set using the supplied list to retain order.
         * <p>
         * A <code>HashSet</code> is used for the set behaviour.
         * <p>
         * NOTE: If the list contains duplicates, the duplicates are removed,
         * altering the specified list.
         *
         * @param list  the list to decorate, must not be null
         * @throws IllegalArgumentException if list is null
         */
        public static ListOrderedSet decorate(java.util.List <Object> list)
        {
            if (list == null)
            {
                throw new java.lang.IllegalArgumentException("List must not be null");
            }
            java.util.Set <Object> set = new java.util.HashSet <Object>(list);
            list.retainAll(set);

            return(new ListOrderedSet(set, list));
        }