Skip to content

Commit

Permalink
refactoring: Use 'iterator' in place of 'autoPageIter' function name
Browse files Browse the repository at this point in the history
  • Loading branch information
JPPortier committed Nov 29, 2023
1 parent fb1abb3 commit 4bef0ed
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void autoPageIter() {
AtomicInteger count = new AtomicInteger();
ActiveNumberListResponse response = new ActiveNumberListResponse(service, pages.get(0));
response
.autoPageIter()
.iterator()
.forEachRemaining(
value -> {
Assertions.assertThat(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AvailableNumberListResponseTest {
void autoPageIter() {
AtomicInteger count = new AtomicInteger();
response
.autoPageIter()
.iterator()
.forEachRemaining(
value -> {
Assertions.assertThat(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class AvailableRegionListResponseTest {
void autoPageIter() {
AtomicInteger count = new AtomicInteger();
response
.autoPageIter()
.iterator()
.forEachRemaining(
value -> {
Assertions.assertThat(value)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ void list() throws ApiException {

BatchesListResponse response = service.list(null);

Iterator<Batch<?>> iterator = response.autoPageIter();
Iterator<Batch<?>> iterator = response.iterator();
Batch<?> batch = iterator.next();
Assertions.assertThat(iterator.hasNext()).isEqualTo(true);
Assertions.assertThat(batch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void list() throws ApiException {

DeliveryReportsListResponse response = service.list(null);

Iterator<DeliveryReportRecipient> iterator = response.autoPageIter();
Iterator<DeliveryReportRecipient> iterator = response.iterator();
DeliveryReportRecipient item = iterator.next();
Assertions.assertThat(iterator.hasNext()).isEqualTo(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void list() throws ApiException {

GroupsListResponse response = service.list(null);

Iterator<Group> iterator = response.autoPageIter();
Iterator<Group> iterator = response.iterator();
Group item = iterator.next();
Assertions.assertThat(iterator.hasNext()).isEqualTo(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void list() throws ApiException {

InboundsListResponse response = service.list(null);

Iterator<Inbound<?>> iterator = response.autoPageIter();
Iterator<Inbound<?>> iterator = response.iterator();
Inbound<?> item = iterator.next();
Assertions.assertThat(iterator.hasNext()).isEqualTo(true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class ListResponse<T> {
*
* @return Iterator onto items
*/
public Iterator<T> autoPageIter() {
public Iterator<T> iterator() {
return new ItemsIterator<>(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void run() {
.build());
AtomicInteger page = new AtomicInteger(1);
response
.autoPageIter()
.iterator()
.forEachRemaining(
value ->
LOGGER.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void run() {
// .setClientReference("a client reference")
// .setStartDate(Instant.now())
.build())
.autoPageIter()
.iterator()
.forEachRemaining(f -> LOGGER.info(f.toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void run() {
Arrays.asList(
DeliveryReportErrorCode.from(0), DeliveryReportErrorCode.DISPATCHED))
.build())
.autoPageIter()
.iterator()
.forEachRemaining(f -> LOGGER.info(f.toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ public void run() {

GroupsListResponse response = client.sms().groups().list();

response.autoPageIter().forEachRemaining(f -> LOGGER.info(f.toString()));
response.iterator().forEachRemaining(f -> LOGGER.info(f.toString()));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ public void run() {
LOGGER.info("List inbounds");

LOGGER.info("Response:");
client
.sms()
.inbounds()
.list(null)
.autoPageIter()
.forEachRemaining(f -> LOGGER.info(f.toString()));
client.sms().inbounds().list(null).iterator().forEachRemaining(f -> LOGGER.info(f.toString()));
}
}

0 comments on commit 4bef0ed

Please sign in to comment.