Advertisement
Guest User

Test1

a guest
Jan 20th, 2013
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.76 KB | None | 0 0
  1. import java.util.HashMap;
  2. import java.util.Map;
  3.  
  4. /**
  5.  *
  6.  * @author Owner
  7.  */
  8. public class TestA {
  9.  
  10.     public static Map < String , Integer > storage = new HashMap < > () ;
  11.    
  12.     /**
  13.      * @param args the command line arguments
  14.      */
  15.     public static void main(String[] args) {
  16.         // TODO code application logic here
  17.         int loopcycle = 0 ;
  18.         int currentposition = 1 ;
  19.         int stage = -1 ;
  20.         int currentvalue = 0 ;
  21.         storage.put( Integer.toString(currentposition), currentposition );
  22.         while(true) {
  23.             //storage.put( Integer.toString( currentposition ) , currentposition );
  24.         //}
  25.             stage++;
  26.             if(stage == 0 ) {
  27.                 currentvalue = storage.get( Integer.toString( currentposition ) );
  28.                 storage.remove( Integer.toString( currentvalue ) ) ;
  29.                 //currentposition++ ;
  30.                 //stage++ ;
  31.                 System.out.println( "Storage Key Removed:" + currentvalue );
  32.                 //loopcycle = 0 ;
  33.             }
  34.             else if(( stage == 1 || stage == 2 || stage == 3 || stage == 4 || stage == 5 || stage == 6 || stage == 7 || stage == 8 || stage == 9 ) ) {
  35.                 //stage++ ;
  36.                 //loopcycle = 0 ;
  37.                 try {
  38.                     Thread.sleep(1000);
  39.                 } catch (Exception e) {
  40.                     e.printStackTrace();
  41.                 }
  42.             }
  43.             else if(stage == 10 ) {
  44.                 storage.put( Integer.toString( currentvalue ) , currentvalue ) ;
  45.                 System.out.println( "Replaced Storage Key: " + currentvalue ) ;
  46.                 //currentposition++ ;
  47.                 loopcycle = 0 ;
  48.                 //stage = 0;
  49.             }
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement