apache commons collections
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import junit.framework.TestCase;
import org.apache.commons.collections.CollectionUtils;
public class MapSubstractTest extends TestCase{
public void testSubstract(){
Map<String,String> source = new HashMap<String,String>();
source.put("소주","삼겹살");
source.put("양주","과일");
source.put("맥주","감자튀김");
source.put("고량주","물초면");
Map<String,String> blackList = new HashMap<String,String>();
blackList.put("고량주","물초면");
Collection<Map.Entry> filetered = CollectionUtils.subtract(source.entrySet(),blackList.entrySet());
System.out.println(filetered);
}
}
History
Last edited on 10/29/2008 22:50 by benelog
Comments (0)