Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 57 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1.     private class KeyValueIterator implements Iterator{
  2.         private ObjectListp[] mapObjectList;
  3.         private int currentBucket = 0;
  4.         private int currentPosition = 0;
  5.        
  6.         private ValueIterator(ObjectList[] objListArray){
  7.             mapObjectList = objListArray;
  8.         }
  9.        
  10.         public boolean hasNext() {
  11.             return currentPosition < objDictionary.getSize();
  12.         }
  13.      
  14.         public Object next() {
  15.             if (hasNext()){
  16.    
  17. ObjectList olist = mapObjectList[currentBucket];
  18. if (olist == null)
  19. {
  20.      currentBucket++;
  21.      while(mapObjectList[currentBucket] == null)
  22.           currentBucket++;
  23.      olist = mapObjectList[currentBjcket];
  24.  
  25.      currentPosition++;
  26.     return olist.getFirst();
  27.  
  28.  
  29. }
  30.  else
  31. {
  32.     olist = mapObjectList[currentBucket];
  33. KeyValueNode kvNode = olist.getNext();
  34. if (kvNode != null)
  35. {
  36.     currentPosition++;
  37.     return kvNode;
  38. }
  39. else
  40. {
  41.      return next();
  42.  
  43. }
  44.      
  45.  
  46. }
  47.  
  48.             }
  49. else
  50. return null;
  51.         }
  52.        
  53.         public void remove(){
  54.             throw new UnsupportedOperationException();
  55.         }
  56.     }
  57.  
  58.     private class KeyIterator implements Iterator{
  59.         KeyValueIterator kvIter;
  60.        
  61.         private ValueIterator(ObjectList[] objListArray){
  62.             kvIter = new KeyValueIterator(objListArray);
  63.         }
  64.        
  65.         public boolean hasNext() {
  66.             return kvIter.hasNext();
  67.         }
  68.      
  69.         public Object next() {
  70.             KeyValueNode kvNode = kvIter.next();
  71.             return kvNode.getKey();
  72.         }
  73.        
  74.         public void remove(){
  75.             throw new UnsupportedOperationException();
  76.         }
  77.     }  
  78.  
  79.     private class ValueIterator implements Iterator{
  80.         KeyValueIterator kvIter;
  81.        
  82.         private ValueIterator(ObjectList[] objListArray){
  83.             kvIter = new KeyValueIterator(objListArray);
  84.         }
  85.        
  86.         public boolean hasNext() {
  87.             return kvIter.hasNext();
  88.         }
  89.      
  90.         public Object next() {
  91.              KeyValueNode kvNode = kvIter.next();
  92.             return kvNode.getValue();
  93.         }
  94.        
  95.         public void remove(){
  96.             throw new UnsupportedOperationException();
  97.         }
  98.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top