Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- import java.util.Map;
- /**
- *
- * @author Owner
- */
- public class TestA {
- public static Map < String , Integer > storage = new HashMap < > () ;
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- int loopcycle = 0 ;
- int currentposition = 1 ;
- int stage = -1 ;
- int currentvalue = 0 ;
- storage.put( Integer.toString(currentposition), currentposition );
- while(true) {
- //storage.put( Integer.toString( currentposition ) , currentposition );
- //}
- stage++;
- if(stage == 0 ) {
- currentvalue = storage.get( Integer.toString( currentposition ) );
- storage.remove( Integer.toString( currentvalue ) ) ;
- //currentposition++ ;
- //stage++ ;
- System.out.println( "Storage Key Removed:" + currentvalue );
- //loopcycle = 0 ;
- }
- else if(( stage == 1 || stage == 2 || stage == 3 || stage == 4 || stage == 5 || stage == 6 || stage == 7 || stage == 8 || stage == 9 ) ) {
- //stage++ ;
- //loopcycle = 0 ;
- try {
- Thread.sleep(1000);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- else if(stage == 10 ) {
- storage.put( Integer.toString( currentvalue ) , currentvalue ) ;
- System.out.println( "Replaced Storage Key: " + currentvalue ) ;
- //currentposition++ ;
- loopcycle = 0 ;
- //stage = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement