Skip to content

Commit c60698f

Browse files
committed
Iterator.remove() has a default implementation
1 parent 9e8bbfd commit c60698f

6 files changed

Lines changed: 8 additions & 20 deletions

File tree

src/main/java/org/kohsuke/github/GHNotificationStream.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,6 @@ private long calcNextCheckTime(GitHubResponse<GHThread[]> response) {
207207
long seconds = Integer.parseInt(v);
208208
return System.currentTimeMillis() + seconds * 1000;
209209
}
210-
211-
public void remove() {
212-
throw new UnsupportedOperationException();
213-
}
214210
};
215211
}
216212

src/main/java/org/kohsuke/github/GHPerson.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ public List<GHRepository> next() {
131131
r.root = root;
132132
return Arrays.asList(batch);
133133
}
134-
135-
public void remove() {
136-
throw new UnsupportedOperationException();
137-
}
138134
};
139135
}
140136
};

src/main/java/org/kohsuke/github/GitHubPageIterator.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ public GitHubResponse<T> finalResponse() {
114114
return finalResponse;
115115
}
116116

117-
public void remove() {
118-
throw new UnsupportedOperationException();
119-
}
120-
121117
/**
122118
* Fetch is called at the start of {@link #hasNext()} or {@link #next()} to fetch another page of data if it is
123119
* needed.

src/main/java/org/kohsuke/github/PagedIterator.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ private void fetch() {
9797
}
9898
}
9999

100-
public void remove() {
101-
throw new UnsupportedOperationException();
102-
}
103-
104100
/**
105101
* Gets the next page worth of data.
106102
*

src/main/java/org/kohsuke/github/PagedSearchIterable.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,6 @@ public T[] next() {
7575
result = v;
7676
return v.getItems(root);
7777
}
78-
79-
public void remove() {
80-
throw new UnsupportedOperationException();
81-
}
8278
};
8379
}
8480
}

src/test/java/org/kohsuke/github/GitHubTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ public void testListAllRepositories() throws Exception {
5353
assertNotNull(r.getUrl());
5454
assertNotEquals(0L, r.getId());
5555
}
56+
57+
// ensure the iterator throws as expected
58+
try {
59+
itr.remove();
60+
fail();
61+
} catch (UnsupportedOperationException e) {
62+
assertThat(e, notNullValue());
63+
}
5664
}
5765

5866
@Test

0 commit comments

Comments
 (0)