[errorprone] fix ReturnValueIgnored in PushCertificateStore#next

Change-Id: I8deb7fa702bb973436b7ca21edf3634a087047b7
This commit is contained in:
Matthias Sohn 2021-09-12 20:17:47 +02:00
parent f3eff2308f
commit 9ba3a521aa
1 changed files with 3 additions and 4 deletions

View File

@ -159,7 +159,7 @@ public PushCertificate get(String refName) throws IOException {
* close resources. * close resources.
*/ */
public Iterable<PushCertificate> getAll(String refName) { public Iterable<PushCertificate> getAll(String refName) {
return () -> new Iterator<PushCertificate>() { return () -> new Iterator<>() {
private final String path = pathName(refName); private final String path = pathName(refName);
private PushCertificate next; private PushCertificate next;
@ -219,11 +219,10 @@ public boolean hasNext() {
@Override @Override
public PushCertificate next() { public PushCertificate next() {
hasNext(); if (!hasNext()) {
PushCertificate n = next;
if (n == null) {
throw new NoSuchElementException(); throw new NoSuchElementException();
} }
PushCertificate n = next;
next = null; next = null;
return n; return n;
} }