Coverage Report - org.mule.util.concurrent.ConcurrentHashSet
 
Classes in this File Line Coverage Branch Coverage Complexity
ConcurrentHashSet
0%
0/29
0%
0/4
1
 
 1  
 /*
 2  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 3  
  * The software in this package is published under the terms of the CPAL v1.0
 4  
  * license, a copy of which has been included with this distribution in the
 5  
  * LICENSE.txt file.
 6  
  */
 7  
 package org.mule.util.concurrent;
 8  
 
 9  
 /*
 10  
  * Written by Doug Lea with assistance from members of JCP JSR-166 Expert Group and
 11  
  * released to the public domain, as explained at
 12  
  * http://creativecommons.org/licenses/publicdomain
 13  
  */
 14  
 
 15  
 import java.io.IOException;
 16  
 import java.io.Serializable;
 17  
 import java.util.AbstractSet;
 18  
 import java.util.Collection;
 19  
 import java.util.Iterator;
 20  
 import java.util.Set;
 21  
 
 22  
 import edu.emory.mathcs.backport.java.util.concurrent.ConcurrentHashMap;
 23  
 
 24  
 public class ConcurrentHashSet/* <E> */extends AbstractSet/* <E> */implements Set/* <E> */, Serializable
 25  
 {
 26  
     private static final long serialVersionUID = 2454657854757543876L;
 27  
 
 28  
     private final ConcurrentHashMap/* <E, Boolean> */map;
 29  
     private transient Set/* <E> */keySet;
 30  
 
 31  
     public ConcurrentHashSet()
 32  0
     {
 33  0
         map = new ConcurrentHashMap/* <E, Boolean> */();
 34  0
         keySet = map.keySet();
 35  0
     }
 36  
 
 37  
     public ConcurrentHashSet(int initialCapacity)
 38  0
     {
 39  0
         map = new ConcurrentHashMap/* <E, Boolean> */(initialCapacity);
 40  0
         keySet = map.keySet();
 41  0
     }
 42  
 
 43  
     public ConcurrentHashSet(int initialCapacity, float loadFactor, int concurrencyLevel)
 44  0
     {
 45  0
         map = new ConcurrentHashMap/* <E, Boolean> */(initialCapacity, loadFactor, concurrencyLevel);
 46  0
         keySet = map.keySet();
 47  0
     }
 48  
 
 49  
     public int size()
 50  
     {
 51  0
         return map.size();
 52  
     }
 53  
 
 54  
     public boolean isEmpty()
 55  
     {
 56  0
         return map.isEmpty();
 57  
     }
 58  
 
 59  
     public boolean contains(Object o)
 60  
     {
 61  0
         return map.containsKey(o);
 62  
     }
 63  
 
 64  
     public Iterator/* <E> */iterator()
 65  
     {
 66  0
         return keySet.iterator();
 67  
     }
 68  
 
 69  
     public Object[] toArray()
 70  
     {
 71  0
         return keySet.toArray();
 72  
     }
 73  
 
 74  
     public/* <T> T[] */Object[] toArray(Object[]/* T[] */a)
 75  
     {
 76  0
         return keySet.toArray(a);
 77  
     }
 78  
 
 79  
     public boolean add(Object/* E */e)
 80  
     {
 81  0
         return map.put(e, Boolean.TRUE) == null;
 82  
     }
 83  
 
 84  
     public boolean remove(Object o)
 85  
     {
 86  0
         return map.remove(o) != null;
 87  
     }
 88  
 
 89  
     public boolean removeAll(Collection/* <?> */c)
 90  
     {
 91  0
         return keySet.removeAll(c);
 92  
     }
 93  
 
 94  
     public boolean retainAll(Collection/* <?> */c)
 95  
     {
 96  0
         return keySet.retainAll(c);
 97  
     }
 98  
 
 99  
     public void clear()
 100  
     {
 101  0
         map.clear();
 102  0
     }
 103  
 
 104  
     public boolean equals(Object o)
 105  
     {
 106  0
         return keySet.equals(o);
 107  
     }
 108  
 
 109  
     public int hashCode()
 110  
     {
 111  0
         return keySet.hashCode();
 112  
     }
 113  
 
 114  
     private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException
 115  
     {
 116  0
         s.defaultReadObject();
 117  0
         keySet = map.keySet();
 118  0
     }
 119  
 
 120  
 }