SHARE
TWEET

Untitled

a guest Sep 22nd, 2019 91 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. import java.io.Serializable;
  3. import java.util.Arrays;
  4. import java.util.HashMap;
  5. import java.util.Map;
  6.  
  7. public class JavaApplication1 {
  8.  
  9.     static int i = 0;
  10.     public static void main(String[] args) {
  11.  
  12.         Pony test = new Pony("Твайлайт","Фиолетовый","Звезда");
  13.         MyContainer cont = new MyContainer(5);
  14.         i = 1;
  15.         cont.insert(0, "Mys");
  16.         cont.insert(1, test);
  17.         cont.ShowAllElem();
  18.     }
  19.    
  20. }
  21. class MyContainer{
  22.     private Map ponylist;
  23.     private int maxSize;
  24.     private int ElemCount;
  25.    
  26.     public MyContainer(int maxSize){
  27.         this.maxSize = maxSize;
  28.         this.ponylist = new HashMap<Integer, Object>();
  29.         ElemCount = 0;
  30.         }
  31.     public void ShowAllElem(){
  32.         int i=0;
  33.         for(i=0;i<ponylist.size();i++){
  34.             System.out.println(ponylist.get(i));
  35.         }
  36.     }
  37.     public Object ShowElem(int index){
  38.         return  ponylist.get(index);
  39.     }
  40.     public void Remove(int index){
  41.         ponylist.remove(index);
  42.         ElemCount--;
  43.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top