@Test public void shouldBeginningReturnAbsentWhenAllIsEmpty() throws IOException { final Storage storage = createStorage(1000, new LinkedList<Pair<Long, int[]>>()); Assert.assertFalse(storage.beginning().isPresent()); }
@Override public Optional<Long> beginning() throws IOException { try { final Iterator<Pair<Long, int[]>> consolidates = all().iterator(); return Optional.of(consolidates.next().first); } catch (NoSuchElementException e) { return Optional.absent(); } }
Storage implements Reader { @Override public Optional<Long> beginning() throws IOException { try { final Iterator<Pair<Long, int[]>> consolidates = all().iterator(); return Optional.of(consolidates.next().first); } catch (NoSuchElementException e) { return Optional.absent(); } } }
Storage implements Reader { @Override public Optional<Long> beginning() throws IOException { try { final Iterator<Pair<Long, int[]>> consolidates = all().iterator(); return Optional.of(consolidates.next().first); } catch (NoSuchElementException e) { return Optional.absent(); } } Storage(final int maximumSize); }
Storage implements Reader { @Override public Optional<Long> beginning() throws IOException { try { final Iterator<Pair<Long, int[]>> consolidates = all().iterator(); return Optional.of(consolidates.next().first); } catch (NoSuchElementException e) { return Optional.absent(); } } Storage(final int maximumSize); @Override Optional<Long> beginning(); @Override Optional<Long> end(); @Override Iterable<Pair<Long, int[]>> during(final long beginning, final long end); abstract void append(long timestamp, int[] values); }
Storage implements Reader { @Override public Optional<Long> beginning() throws IOException { try { final Iterator<Pair<Long, int[]>> consolidates = all().iterator(); return Optional.of(consolidates.next().first); } catch (NoSuchElementException e) { return Optional.absent(); } } Storage(final int maximumSize); @Override Optional<Long> beginning(); @Override Optional<Long> end(); @Override Iterable<Pair<Long, int[]>> during(final long beginning, final long end); abstract void append(long timestamp, int[] values);  }