List of usage examples for org.apache.lucene.util BytesRefHash find
public int find(BytesRef bytes)
From source file:de.unihildesheim.iw.lucene.util.BytesRefUtilsTest.java
License:Open Source License
@SuppressWarnings("ImplicitNumericConversion") @Test//from ww w . jav a 2s . com public void testHashToArray() throws Exception { final Collection<String> data = new HashSet<>(3); data.add("foo"); data.add("bar"); data.add("baz"); final BytesRefHash brh = new BytesRefHash(); data.stream().map(BytesRef::new).forEach(brh::add); final BytesRefArray bra = BytesRefUtils.hashToArray(brh); Assert.assertEquals("Not all terms found.", data.size(), bra.size()); final BytesRefIterator bri = bra.iterator(); BytesRef br; while ((br = bri.next()) != null) { Assert.assertNotSame("BytesRef not found.", -1, brh.find(br)); } }