List of usage examples for java.util.function LongSupplier getAsLong
long getAsLong();
From source file:Main.java
public static void main(String[] args) { LongSupplier i = () -> Long.MAX_VALUE; System.out.println(i.getAsLong()); }
From source file:com.gemstone.gemfire.internal.LocalStatisticsImplJUnitTest.java
@Test public void invokeLongSuppliersShouldUpdateStats() { LongSupplier supplier1 = mock(LongSupplier.class); when(supplier1.getAsLong()).thenReturn(23L); stats.setLongSupplier(4, supplier1); assertEquals(0, stats.invokeSuppliers()); verify(supplier1).getAsLong();//from ww w . ja v a 2s . com assertEquals(23L, stats.getLong(4)); }
From source file:org.briljantframework.array.AbstractLongArray.java
@Override public LongArray assign(LongSupplier supplier) { for (int i = 0; i < size(); i++) { set(i, supplier.getAsLong()); }/* w w w .j a v a2 s .c o m*/ return this; }
From source file:org.pentaho.ctools.cpf.repository.utils.OverlayAccess.java
/** * Extend IBasicFile interface, but delay obtaining the possibly costly lastModfied value * @param basicFile//from w ww. j a va2 s . com * @param lastModified * @return */ private IBasicFileExt extendBasicFile(IBasicFile basicFile, LongSupplier lastModified) { return new IBasicFileExt() { @Override public long getLastModified() { return lastModified.getAsLong(); } @Override public InputStream getContents() throws IOException { return basicFile.getContents(); } @Override public String getName() { return basicFile.getName(); } @Override public String getFullPath() { return basicFile.getFullPath(); } @Override public String getPath() { /* remove basePath prefix */ String path = basicFile.getFullPath(); if (path.startsWith(basePath)) { path = path.substring(basePath.length()); } return path; } @Override public String getExtension() { return basicFile.getExtension(); } @Override public boolean isDirectory() { return basicFile.isDirectory(); } }; }