private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }
private static <T> Node<T> with(final T o) { Objects.requireNonNull(o, "Only HEAD nodes are allowed to hold null values"); if (o instanceof Node) { final Node node = (Node) o; //only a node that not belong already to a list is allowed to be reused if (node.prev == null && node.next == null) { //reset the iterCount node.iterCount = 0; return node; } } return new NodeHolder<>(o); } }