9 package javolution.util.internal.set.sorted;
11 import java.util.Iterator;
12 import java.util.NoSuchElementException;
32 if (
ahead)
return true;
51 public void remove() {
62 if ((
from !=
null) && (
to !=
null)
64 "from: " +
from +
", to: " +
to);
70 public boolean add(E e) {
72 if ((
from !=
null) && (cmp.
compare(e,
from) < 0))
throw new IllegalArgumentException(
73 "Element: " + e +
" outside of this sub-set bounds");
74 if ((
to !=
null) && (cmp.
compare(e,
to) >= 0))
throw new IllegalArgumentException(
75 "Element: " + e +
" outside of this sub-set bounds");
81 return target().comparator();
84 @SuppressWarnings(
"unchecked")
89 if ((
to !=
null) && (cmp.
compare((E) obj,
to) >= 0))
return false;
90 return target().contains(obj);
97 if (!it.hasNext())
throw new NoSuchElementException();
113 if (
to ==
null)
return target().last();
115 if (!it.hasNext())
throw new NoSuchElementException();
117 while (it.hasNext()) {
123 @SuppressWarnings(
"unchecked")
125 public boolean remove(Object obj) {
128 if ((
to !=
null) && (cmp.
compare((E) obj,
to) >= 0))
return false;
129 return target().remove(obj);
136 while (it.hasNext()) {