Code example for HashMap

Methods: containsKey, get, put

0
		} 
 
		@Override 
		public Fragment getItem(int position) { 
			 
			if(mFragment.containsKey(position)) 
				return mFragment.get(position); 
			 
			switch (position) { 
			/* Process */  
			case 0: 
				mFragment.put(0, new ProcessFragment()); 
				break; 
 
			/* Connection */ 
			case 1: 
				mFragment.put(1, new ConnectionFragment()); 
				break; 
 
			/* Misc */  
			case 2: 
				mFragment.put(2, new MiscFragment()); 
				break; 
 
			/* Message */ 
			case 3: 
				mFragment.put(3, new MessageFragment()); 
				break; 
				 
			/* Monitor */ 
			case 4: 
				// under construction 
				break; 
			} 
			return mFragment.get(position); 
		}  
 
		@Override 
		public int getCount() { 
			return 4;