VoidConsumer.java 805 B

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright (c) 2000, 2001 Per M.A. Bothner and Brainfood Inc.
  2. // This is free software; for terms and warranty disclaimer see ./COPYING.
  3. package gnu.lists;
  4. /** A Consumer that does nothing. */
  5. public class VoidConsumer extends FilterConsumer
  6. {
  7. public static VoidConsumer instance = new VoidConsumer();
  8. public static VoidConsumer getInstance() { return instance; }
  9. public VoidConsumer()
  10. {
  11. super(null);
  12. skipping = true;
  13. }
  14. public VoidConsumer (Consumer out) {
  15. super(out);
  16. skipping = true;
  17. }
  18. public static VoidConsumer make(Consumer old) {
  19. return new VoidConsumer(old);
  20. }
  21. /** True if consumer is ignoring rest of element.
  22. * The producer can use this information to skip ahead. */
  23. public boolean ignoring()
  24. {
  25. return true;
  26. }
  27. }