Advertisement
Guest User

DataList.java

a guest
Nov 10th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package me.henry.dataapi;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. /**
  6. * <h1><b>DataFile</b></h1>
  7. * The DataFileList class lets you create lists that can be saved to files
  8. *
  9. * @author Skionz
  10. */
  11. public class DataList {
  12. private ArrayList<String> list;
  13. public DataList() {
  14. this.list = new ArrayList<String>();
  15. }
  16. public void add(String toAdd) {
  17. this.list.add(toAdd);
  18. }
  19. public void remove(String toRemove) {
  20. this.list.remove(toRemove);
  21. }
  22. public void clear() {
  23. this.list.clear();
  24. }
  25. public String toString() {
  26. String string = "";
  27. for(int count = 0; count <= this.list.size() - 1; count++) {
  28. String value = this.list.get(count);
  29. if(count == 0) {
  30. string += value;
  31. }
  32. else {
  33. string += "," + value;
  34. }
  35. }
  36. return string;
  37. }
  38. public ArrayList<String> toArrayList() {
  39. return this.list;
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement