< prev index next >
src/java.base/share/classes/java/nio/file/DirectoryStream.java
Print this page
rev 53930 : 8148917: enhanced-for statement should allow streams
Reviewed-by: XXX
*** 1,7 ****
/*
! * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 32,45 ****
/**
* An object to iterate over the entries in a directory. A directory stream
* allows for the convenient use of the for-each construct to iterate over a
* directory.
*
! * <p> <b> While {@code DirectoryStream} extends {@code Iterable}, it is not a
* general-purpose {@code Iterable} as it supports only a single {@code
* Iterator}; invoking the {@link #iterator iterator} method to obtain a second
! * or subsequent iterator throws {@code IllegalStateException}. </b>
*
* <p> An important property of the directory stream's {@code Iterator} is that
* its {@link Iterator#hasNext() hasNext} method is guaranteed to read-ahead by
* at least one element. If {@code hasNext} method returns {@code true}, and is
* followed by a call to the {@code next} method, it is guaranteed that the
--- 32,45 ----
/**
* An object to iterate over the entries in a directory. A directory stream
* allows for the convenient use of the for-each construct to iterate over a
* directory.
*
! * <p> {@code DirectoryStream} extends {@code IterableOnce}. It is not a
* general-purpose {@code Iterable} as it supports only a single {@code
* Iterator}; invoking the {@link #iterator iterator} method to obtain a second
! * or subsequent iterator throws {@code IllegalStateException}.
*
* <p> An important property of the directory stream's {@code Iterator} is that
* its {@link Iterator#hasNext() hasNext} method is guaranteed to read-ahead by
* at least one element. If {@code hasNext} method returns {@code true}, and is
* followed by a call to the {@code next} method, it is guaranteed that the
*** 115,125 ****
*
* @see Files#newDirectoryStream(Path)
*/
public interface DirectoryStream<T>
! extends Closeable, Iterable<T> {
/**
* An interface that is implemented by objects that decide if a directory
* entry should be accepted or filtered. A {@code Filter} is passed as the
* parameter to the {@link Files#newDirectoryStream(Path,DirectoryStream.Filter)}
* method when opening a directory to iterate over the entries in the
--- 115,125 ----
*
* @see Files#newDirectoryStream(Path)
*/
public interface DirectoryStream<T>
! extends Closeable, IterableOnce<T> {
/**
* An interface that is implemented by objects that decide if a directory
* entry should be accepted or filtered. A {@code Filter} is passed as the
* parameter to the {@link Files#newDirectoryStream(Path,DirectoryStream.Filter)}
* method when opening a directory to iterate over the entries in the
< prev index next >