public Factory(List<Supplier<LookupSource>> partitions) { this.lookupSources = partitions.stream() .map(Supplier::get) .toArray(LookupSource[]::new); visitedPositions = Arrays.stream(this.lookupSources) .map(LookupSource::getJoinPositionCount) .map(Math::toIntExact) .map(boolean[]::new) .toArray(boolean[][]::new); }
@Override public File[] listFiles( File directory, final FilenameFilter filter ) { try ( Stream<Path> listing = Files.list( path( directory ) ) ) { return listing .filter( entry -> filter.accept( entry.getParent().toFile(), entry.getFileName().toString() ) ) .map( Path::toFile ) .toArray( File[]::new ); } catch ( IOException e ) { return null; } }
@Override public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException { Properties properties = new PrestoDriverUri(url, info).getProperties(); return ConnectionProperties.allProperties().stream() .map(property -> property.getDriverPropertyInfo(properties)) .toArray(DriverPropertyInfo[]::new); }
/** * Creates a classloader respecting the classpath option. * * @return the classloader. */ protected synchronized ClassLoader createClassloader() { URL[] urls = classpath.stream().map(path -> { File file = new File(path); try { return file.toURI().toURL(); } catch (MalformedURLException e) { throw new IllegalStateException(e); } }).toArray(URL[]::new); return new URLClassLoader(urls, this.getClass().getClassLoader()); }