1 19 package bak.pcj.adapter; 20 21 import bak.pcj.list.ByteListIterator; 22 import bak.pcj.util.Exceptions; 23 import java.util.ListIterator ; 24 25 57 public class ListIteratorToByteListIteratorAdapter implements ByteListIterator { 58 59 60 protected ListIterator iterator; 61 62 72 public ListIteratorToByteListIteratorAdapter(ListIterator iterator) { 73 if (iterator == null) 74 Exceptions.nullArgument("iterator"); 75 this.iterator = iterator; 76 } 77 78 public void add(byte v) 79 { iterator.add(new Byte (v)); } 80 81 public boolean hasNext() 82 { return iterator.hasNext(); } 83 84 public boolean hasPrevious() 85 { return iterator.hasPrevious(); } 86 87 public byte next() 88 { return ((Byte )iterator.next()).byteValue(); } 89 90 public int nextIndex() 91 { return iterator.nextIndex(); } 92 93 public byte previous() 94 { return ((Byte )iterator.previous()).byteValue(); } 95 96 public int previousIndex() 97 { return iterator.previousIndex(); } 98 99 public void remove() 100 { iterator.remove(); } 101 102 public void set(byte v) 103 { iterator.set(new Byte (v)); } 104 105 } | Popular Tags |