Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[7.1.0] Improve the documentation for PathFragment methods dealing with segments. #21275

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public int compareTo(PathFragment o) {
////////////////////////////////////////////////////////////////////////

/**
* Returns the number of segments in this path.
* Returns the number of segments in this path, excluding the drive string for absolute paths.
*
* <p>This operation is O(N) on the length of the string.
*/
Expand Down Expand Up @@ -500,6 +500,10 @@ public String getSegment(int index) {
* </code>. Thus the number of segments in the new PathFragment is <code>endIndex - beginIndex
* </code>.
*
* <p>If the path is absolute and <code>beginIndex</code> is zero, the returned path is absolute.
* Otherwise, if the path is relative or <code>beginIndex> is greater than zero, the returned path
* is relative.
*
* <p>This operation is O(N) on the length of the string.
*
* @param beginIndex the beginning index, inclusive.
Expand Down Expand Up @@ -556,7 +560,7 @@ private PathFragment subFragmentImpl(int beginIndex, int endIndex) {
throw new IndexOutOfBoundsException(
String.format("path: %s, beginIndex: %d endIndex: %d", toString(), beginIndex, endIndex));
}
// If beginIndex is 0 we include the drive. Very odd semantics.
// If beginIndex is 0, we include the drive string.
int driveStrLength = 0;
if (beginIndex == 0) {
starti = 0;
Expand Down
Loading