001 /* 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017 package org.apache.commons.collections; 018 019 import java.util.Collection; 020 import java.util.HashMap; 021 022 /** 023 * A {@link Bag} that is backed by a {@link HashMap}. 024 * 025 * @deprecated Moved to bag subpackage and rewritten internally. Due to be removed in v4.0. 026 * @since Commons Collections 2.0 027 * @version $Revision: 646777 $ $Date: 2008-04-10 13:33:15 +0100 (Thu, 10 Apr 2008) $ 028 * 029 * @author Chuck Burdick 030 */ 031 public class HashBag extends DefaultMapBag implements Bag { 032 033 /** 034 * Constructs an empty <Code>HashBag</Code>. 035 */ 036 public HashBag() { 037 super(new HashMap()); 038 } 039 040 /** 041 * Constructs a {@link Bag} containing all the members of the given 042 * collection. 043 * 044 * @param coll a collection to copy into this bag 045 */ 046 public HashBag(Collection coll) { 047 this(); 048 addAll(coll); 049 } 050 051 }