All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.json.ModifyAwareListIterator Maven / Gradle / Ivy

There is a newer version: 15.8.1
Show newest version
package io.ebeaninternal.json;

import java.util.ListIterator;

/**
 * Modify aware wrapper of a ListIterator.
 */
public class ModifyAwareListIterator implements ListIterator {

  final ModifyAwareOwner owner;

  final ListIterator iterator;

  public ModifyAwareListIterator(ModifyAwareOwner owner, ListIterator iterator) {
    this.owner = owner;
    this.iterator = iterator;
  }

  @Override
  public boolean hasNext() {
    return iterator.hasNext();
  }

  @Override
  public E next() {
    return iterator.next();
  }

  @Override
  public boolean hasPrevious() {
    return iterator.hasPrevious();
  }

  @Override
  public E previous() {
    return iterator.previous();
  }

  @Override
  public int nextIndex() {
    return iterator.nextIndex();
  }

  @Override
  public int previousIndex() {
    return iterator.previousIndex();
  }

  @Override
  public void remove() {
    owner.markAsModified();
    iterator.remove();
  }

  @Override
  public void set(E e) {
    owner.markAsModified();
    iterator.set(e);
  }

  @Override
  public void add(E e) {
    owner.markAsModified();
    iterator.add(e);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy