/** * Returns an array containing all elements of this set. * * @param a the destination array. * @return an array containing all elements of this set. * @throws DataAccessLayerException in case of data access failure. * @param <E> the element kind. */ @SuppressWarnings("hiding") public <E> E[] toArray(final E[] a) throws DataAccessLayerException { return _map.keySet().toArray(a); } }
/** * Returns an array containing all elements of this set. * * @param a the destination array. * @return an array containing all elements of this set. * @throws DataAccessLayerException in case of data access failure. * @param <E> the element kind. */ @SuppressWarnings("hiding") public <E> E[] toArray(final E[] a) throws DataAccessLayerException { return _map.keySet().toArray(a); } }
/** * Clears all entries from the underlying persistent entity. * * @throws DataAccessLayerException in case of data access failure. */ public void clear() throws DataAccessLayerException { for (final K key : keySet()) { remove(key); } _size = 0; }
/** * Clears all entries from the underlying persistent entity. * * @throws DataAccessLayerException in case of data access failure. */ public void clear() throws DataAccessLayerException { for (final K key : keySet()) { remove(key); } _size = 0; }
/** * Removes from this set all elements that are not within a given set of elements. * * @param collect the set of elements to be retained. * @return true if at least one element has been retained. * @throws DataAccessLayerException in case of data access failure. */ public boolean retainAll(final Collection<? extends E> collect) throws DataAccessLayerException { if (collect == null || collect.isEmpty()) { return false; } boolean changed = false; final Set<E> keys = new HashSet<E>(_map.keySet()); for (final E key : keys) { if (!collect.contains(key)) { changed = changed | remove(key); } } return changed; }
/** * Removes from this set all elements that are not within a given set of elements. * * @param collect the set of elements to be retained. * @return true if at least one element has been retained. * @throws DataAccessLayerException in case of data access failure. */ public boolean retainAll(final Collection<? extends E> collect) throws DataAccessLayerException { if (collect == null || collect.isEmpty()) { return false; } boolean changed = false; final Set<E> keys = new HashSet<E>(_map.keySet()); for (final E key : keys) { if (!collect.contains(key)) { changed = changed | remove(key); } } return changed; }
/** * Returns a set containing all keys within thid map. * * @return a set containing all keys within thid map. * @throws DataAccessLayerException in case of data access failure. */ public Set<Map.Entry<K, V>> entrySet() throws DataAccessLayerException { final Set<Map.Entry<K, V>> entrySet = new HashSet<Map.Entry<K, V>>(); for (final K key : keySet()) { entrySet.add(new Entry(key, get(key))); } return entrySet; }
/** * Returns a set containing all keys within thid map. * * @return a set containing all keys within thid map. * @throws DataAccessLayerException in case of data access failure. */ public Set<Map.Entry<K, V>> entrySet() throws DataAccessLayerException { final Set<Map.Entry<K, V>> entrySet = new HashSet<Map.Entry<K, V>>(); for (final K key : keySet()) { entrySet.add(new Entry(key, get(key))); } return entrySet; }
/** * Returns a collection containing all values of this map. * * @return a collection containing all values of this map. * @throws DataAccessLayerException in case of data access failure. */ public Collection<V> values() throws DataAccessLayerException { final List<V> values = new LinkedList<V>(); for (final K key : keySet()) { final Object val = get(key); if (val != null) { values.add(get(key)); } } return values; } }
/** * Returns a collection containing all values of this map. * * @return a collection containing all values of this map. * @throws DataAccessLayerException in case of data access failure. */ public Collection<V> values() throws DataAccessLayerException { final List<V> values = new LinkedList<V>(); for (final K key : keySet()) { final Object val = get(key); if (val != null) { values.add(get(key)); } } return values; } }
@Override protected void clearNamespacesInternal() throws SailException { try { PersistentMap<String, String> prefix2ns = _crdf.getPrefix2Namespaces(); for (String prefix : prefix2ns.keySet()) { prefix2ns.remove(prefix); } } catch (DataAccessLayerException exception) { throw new SailException(exception); } }
@Override protected void clearNamespacesInternal() throws SailException { try { PersistentMap<String, String> prefix2ns = _crdf.getPrefix2Namespaces(); for (String prefix : prefix2ns.keySet()) { prefix2ns.remove(prefix); } } catch (DataAccessLayerException exception) { throw new SailException(exception); } }
@Before public void reset() throws DataAccessLayerException { for (String key : map.keySet()) { map.remove(key); } for (Map.Entry<String, String> entry : TESTDATA1.entrySet()) { map.put(entry.getKey(), entry.getValue()); } }
@Test public void entrySetTest() throws DataAccessLayerException { assertEquals(TESTDATA1.keySet(), map.keySet()); }
@Test public void keySetTest() throws DataAccessLayerException { assertEquals(TESTDATA1.keySet(), map.keySet()); }