Skip to content

Instantly share code, notes, and snippets.

@josedonizetti
Created February 9, 2011 02:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josedonizetti/817769 to your computer and use it in GitHub Desktop.
Save josedonizetti/817769 to your computer and use it in GitHub Desktop.
Database.java used at the restfulie-java one minute tutorial.
public class Database {
private final List<Item> items;
public Database(){
items = new ArrayList<Item>();
items.add(createItem(1,"restfulie-book", 25.00));
items.add(createItem(2,"restf in practice", 35.00));
}
public List<Item> getItems(){
return items;
}
public Item getItem(Integer id){
return items.get(id - 1);
}
private Item createItem(Integer id, String name, Double price){
return new Item(id,name,price);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment