lundi 2 novembre 2015

If statement to match a string containing same characters

Hi I'm new please go easy on me but I'm not sure how to create a if statement that will check a string for the text searched by a user and print out all details of relevant users.

import java.util.*;

public class Library
{
    Map<String , Book> books;
    Map<String , User> users;

    public Library()
    {
      books = new HashMap<String, Book>();
      users = new HashMap<String, User>();
    }

public void searchUser(String searchStringUser)
{
    for (Map.Entry<String, User> entry : users.entrySet())
    {
        System.out.println(entry.getValue());
    }
}
**here is where I need the if statement to search the array for the correct details**
public void searchBook(String searchStringBooks)
{
    for (Map.Entry<String, Book> entry : books.entrySet())
    {
        System.out.println(entry.getValue());
    }
}

thanks in advance

Aucun commentaire:

Enregistrer un commentaire