Code example for AbstractMap

Methods: getput

0
	 * @param sideLeft 
	 * @return null if not found 
	 */ 
	public RIGHTSIDE getRightSide( LEFTSIDE sideLeft ) {
		nn( sideLeft );
		RIGHTSIDE ret = mapLRForward.get( sideLeft );
		return ret;
	} 
	 
	 
	/** 
	 * @param sideRight 
	 * @return null if not found 
	 */ 
	public LEFTSIDE getLeftSide( RIGHTSIDE sideRight ) {
		nn( sideRight );
		LEFTSIDE ret = mapRLBackward.get( sideRight );
		return ret;
	} 
	 
	 
	public boolean putLR( LEFTSIDE sideLeft, RIGHTSIDE sideRight ) {
		nn( sideLeft );
		nn( sideRight );
//		boolean existed1 = mapLRForward.containsKey( sideLeft ); 
//		boolean existed2 = mapRLBackward.containsKey( sideRight ); 
		RIGHTSIDE prevVal = mapLRForward.put( sideLeft, sideRight );
		LEFTSIDE prevKey = mapRLBackward.put( sideRight, sideLeft );
		if ( ( null != prevVal ) ^ ( null != prevKey ) ) {
			// inconsistency detected somehow 
			// 0 xor 0 = 0 
			// 1 xor 0 = 1