Advertisement
piffy

UML Reverse

May 2nd, 2019
610
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.65 KB | None | 0 0
  1. import java.util.Vector;
  2.  
  3. public class Driver {
  4.     private StringContainer b = null;
  5.  
  6.     public static void main(String[] args){
  7.         Driver d = new Driver();
  8.         d.run();
  9.     }
  10.  
  11.     public void run() {
  12.         b = new StringContainer();
  13.         b.add("One");
  14.         b.add("Two");
  15.         b.remove("One");
  16.     }
  17. }
  18.  
  19. class StringContainer {
  20.     private Vector v = null;
  21.  
  22.     public void add(String s) {
  23.         init();
  24.         v.add(s);
  25.     }
  26.  
  27.     public boolean remove(String s) {
  28.         init();
  29.         return v.remove(s);
  30.     }
  31.  
  32.     private void init() {
  33.         if (v == null)
  34.             v = new Vector();
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement