Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.jackson.databind.util;

Node of a forward-only linked list.

Parameters:
<T> Type of contained object
Author(s):
tatu
 
public final class LinkedNode<T>
    final T _value;
    final LinkedNode<T> _next;
    
    public LinkedNode(T valueLinkedNode<T> next)
    {
         = value;
         = next;
    }
    
    public LinkedNode<T> next() { return ; }
    
    public T value() { return ; }
    
    
Convenience method that can be used to check if a linked list with given head node (which may be null to indicate empty list) contains given value

Parameters:
<ST> Type argument that defines contents of the linked list parameter
node Head node of the linked list
value Value to look for
Returns:
True if linked list contains the value, false otherwise
    public static <ST> boolean contains(LinkedNode<ST> node, ST value)
    {
        while (node != null) {
            if (node.value() == value) {
                return true;
            }
            node = node.next();
        }
        return false;
    }
New to GrepCode? Check out our FAQ X