Skip to content

Commit

Permalink
Saving updates.
Browse files Browse the repository at this point in the history
  • Loading branch information
kqarryzada committed May 9, 2024
1 parent 2f6ec9b commit 7026e0a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,19 @@ public void reset()

/**
* {@inheritDoc}
* <br><br>
* If {@code n} is less than 0, no values will be skipped.
*/
@Override
public long skip(final long n)
{
long chars = Math.min(string.length() - pos, n);
pos += chars;
chars = Math.max(chars, 0);

// The left side of Math.min() is an integer, and 'chars' will always be
// non-negative, so 'chars' can always be represented as an int.
pos += (int) chars;

return chars;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,12 @@
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Pattern;

/**
* This class provides a number of static utility functions.
*/
public final class StaticUtils
{
@NotNull
private static final Pattern SEPARATOR = Pattern.compile("\\s*,\\s*");

/**
* Prevent this class from being instantiated.
*/
Expand Down Expand Up @@ -240,7 +236,13 @@ public static <T> Set<T> arrayToSet(@NotNull final T... i)
@NotNull
public static String[] splitCommaSeparatedString(@NotNull final String str)
{
return SEPARATOR.split(str.trim());
var separatedArray = str.split(",");
for (int i = 0; i < separatedArray.length; i++)
{
separatedArray[i] = separatedArray[i].trim();
}

return separatedArray;
}


Expand Down

0 comments on commit 7026e0a

Please sign in to comment.