JAVA - find element in linked list
hey i have to solve this programme:

Write a method find() that takes an instance of LinkedStackOfStrings and
a string key as arguments and returns true if some node in the list has key as
its item field, false otherwise. Test your function in a test client. This test
client may be the main function in the class LinkedStackOfStrings.

in java, this is what if got so far:

    public class Stack<Item>
{
    private Node first;

    private class Node
    {
	Item item;
	Node next;
    }

    public boolean isEmpty()
    {
	return ( first == null );
    }

    public void push( Item item )
    {
	Node oldfirst = first;
	first = new Node();
	first.item = item;
	first.next = oldfirst;
    }

    public Item pop()
    {
	Item item = first.item;
	first = first.next;
	return item;
    }

    public static void main( String[] args )
    {
	Stack<String> collection = new Stack<String>();
      
	String key = "be";

	collection.find( key );
	
	while( !StdIn.isEmpty() )
	    {
		String item = StdIn.readString();
		if( !item.equals("-") )
		    collection.push( item );
		else 
		    StdOut.print( collection.pop() + " " );
	    }
    }

    public void find( String key )
    {   
	for( Node x = first; x != null; x = x.next )
	    {
		if( x.item == key )
		    StdOut.println( x.item );
	    }
    }
}

plz a need help
JAVA - find element in linked list
===

hey i have to solve this programme:

Write a method find() that takes an instance of LinkedStackOfStrings and
a string key as arguments and returns true if some node in the list has key as
its item field, false otherwise. Test your function in a test client. This test
client may be the main function in the class LinkedStackOfStrings.

in java, this is what if got so far:

    public class Stack<Item>
{
    private Node first;

    private class Node
    {
	Item item;
	Node next;
    }

    public boolean isEmpty()
    {
	return ( first == null );
    }

    public void push( Item item )
    {
	Node oldfirst = first;
	first = new Node();
	first.item = item;
	first.next = oldfirst;
    }

    public Item pop()
    {
	Item item = first.item;
	first = first.next;
	return item;
    }

    public static void main( String[] args )
    {
	Stack<String> collection = new Stack<String>();
      
	String key = "be";

	collection.find( key );
	
	while( !StdIn.isEmpty() )
	    {
		String item = StdIn.readString();
		if( !item.equals("-") )
		    collection.push( item );
		else 
		    StdOut.print( collection.pop() + " " );
	    }
    }

    public void find( String key )
    {   
	for( Node x = first; x != null; x = x.next )
	    {
		if( x.item == key )
		    StdOut.println( x.item );
	    }
    }
}

plz a need help