Peformed a code review and Javadoc review.
This commit is contained in:
parent
0845ab52e8
commit
06cf653dfc
11 changed files with 519 additions and 232 deletions
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -21,14 +21,14 @@ package fr.devinsy.util.strings;
|
|||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Class StringLengthComparator.
|
||||
*/
|
||||
public class StringLengthComparator implements Comparator<String>
|
||||
{
|
||||
private static StringLengthComparator instance;
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(final String alpha, final String bravo)
|
||||
|
@ -39,13 +39,10 @@ public class StringLengthComparator implements Comparator<String>
|
|||
Integer alphaValue;
|
||||
if (alpha == null)
|
||||
{
|
||||
//
|
||||
alphaValue = null;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
alphaValue = alpha.length();
|
||||
}
|
||||
|
||||
|
@ -53,13 +50,10 @@ public class StringLengthComparator implements Comparator<String>
|
|||
Integer bravoValue;
|
||||
if (bravo == null)
|
||||
{
|
||||
//
|
||||
bravoValue = null;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
bravoValue = bravo.length();
|
||||
}
|
||||
|
||||
|
@ -98,25 +92,18 @@ public class StringLengthComparator implements Comparator<String>
|
|||
//
|
||||
if ((alpha == null) && (bravo == null))
|
||||
{
|
||||
//
|
||||
result = 0;
|
||||
|
||||
}
|
||||
else if (alpha == null)
|
||||
{
|
||||
//
|
||||
result = -1;
|
||||
|
||||
}
|
||||
else if (bravo == null)
|
||||
{
|
||||
//
|
||||
result = +1;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//
|
||||
result = alpha.compareTo(bravo);
|
||||
}
|
||||
|
||||
|
@ -125,8 +112,9 @@ public class StringLengthComparator implements Comparator<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Instance.
|
||||
*
|
||||
* @return
|
||||
* @return the string length comparator
|
||||
*/
|
||||
public static StringLengthComparator instance()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2008-2010 Christian Pierre MOMON
|
||||
* Copyright (C) 2013-2015 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
/*
|
||||
* Copyright (C) 2008-2010,2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
*
|
||||
|
@ -323,9 +321,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param string
|
||||
* @return
|
||||
* the string
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final Collection<String> string)
|
||||
{
|
||||
|
@ -338,9 +338,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final double value)
|
||||
{
|
||||
|
@ -353,9 +355,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final int value)
|
||||
{
|
||||
|
@ -368,9 +372,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final long value)
|
||||
{
|
||||
|
@ -383,9 +389,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final Object value)
|
||||
{
|
||||
|
@ -398,9 +406,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param value
|
||||
* @return
|
||||
* the value
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final short value)
|
||||
{
|
||||
|
@ -413,9 +423,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param string
|
||||
* @return
|
||||
* the string
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final String string)
|
||||
{
|
||||
|
@ -428,9 +440,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Appendln.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* the strings
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList appendln(final String... strings)
|
||||
{
|
||||
|
@ -461,9 +475,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Char at.
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
* the position
|
||||
* @return the char
|
||||
*/
|
||||
public char charAt(final StringListCharPosition position)
|
||||
{
|
||||
|
@ -480,7 +496,7 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
* Deep copy and shallow copy have no sense about a list of immutable
|
||||
* objects.
|
||||
*
|
||||
* @return
|
||||
* @return the string list
|
||||
*/
|
||||
@Override
|
||||
public StringList clone()
|
||||
|
@ -499,9 +515,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains any.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* @param target
|
||||
* the target
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean containsAny(final Collection<String> target)
|
||||
{
|
||||
|
@ -541,9 +559,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains any.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* @param target
|
||||
* the target
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean containsAny(final String... target)
|
||||
{
|
||||
|
@ -587,8 +607,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains blank.
|
||||
*
|
||||
* @return
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean containsBlank()
|
||||
{
|
||||
|
@ -621,8 +642,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains empty.
|
||||
*
|
||||
* @return
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean containsEmpty()
|
||||
{
|
||||
|
@ -655,8 +677,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains null.
|
||||
*
|
||||
* @return
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean containsNull()
|
||||
{
|
||||
|
@ -689,9 +712,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the by index.
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
* the id
|
||||
* @return the by index
|
||||
*/
|
||||
public String getByIndex(final int id)
|
||||
{
|
||||
|
@ -704,8 +729,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the first.
|
||||
*
|
||||
* @return
|
||||
* @return the first
|
||||
*/
|
||||
public String getFirst()
|
||||
{
|
||||
|
@ -746,8 +772,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the longest bytes line.
|
||||
*
|
||||
* @return
|
||||
* @return the longest bytes line
|
||||
*/
|
||||
public String getLongestBytesLine()
|
||||
{
|
||||
|
@ -776,8 +803,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the longest line.
|
||||
*
|
||||
* @return
|
||||
* @return the longest line
|
||||
*/
|
||||
public String getLongestLine()
|
||||
{
|
||||
|
@ -806,8 +834,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the not blank.
|
||||
*
|
||||
* @return
|
||||
* @return the not blank
|
||||
*/
|
||||
public StringList getNotBlank()
|
||||
{
|
||||
|
@ -828,8 +857,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the not empty.
|
||||
*
|
||||
* @return
|
||||
* @return the not empty
|
||||
*/
|
||||
public StringList getNotEmpty()
|
||||
{
|
||||
|
@ -850,8 +880,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the not null.
|
||||
*
|
||||
* @return
|
||||
* @return the not null
|
||||
*/
|
||||
public StringList getNotNull()
|
||||
{
|
||||
|
@ -872,8 +903,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the shortest bytes line.
|
||||
*
|
||||
* @return
|
||||
* @return the shortest bytes line
|
||||
*/
|
||||
public String getShortestBytesLine()
|
||||
{
|
||||
|
@ -902,8 +934,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the shortest line.
|
||||
*
|
||||
* @return
|
||||
* @return the shortest line
|
||||
*/
|
||||
public String getShortestLine()
|
||||
{
|
||||
|
@ -932,9 +965,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Index of.
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
* the index
|
||||
* @return the string list char position
|
||||
*/
|
||||
public StringListCharPosition indexOf(final int index)
|
||||
{
|
||||
|
@ -971,8 +1006,10 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Index of next line not null.
|
||||
*
|
||||
* @param startIndex
|
||||
* the start index
|
||||
* @return the index of the next line not null, -1 otherwise.
|
||||
*/
|
||||
public int indexOfNextLineNotNull(final int startIndex)
|
||||
|
@ -1008,9 +1045,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if is out of bounds.
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
* the position
|
||||
* @return true, if is out of bounds
|
||||
*/
|
||||
public boolean isOutOfBounds(final StringListCharPosition position)
|
||||
{
|
||||
|
@ -1041,9 +1080,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if is out of line.
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
* the position
|
||||
* @return true, if is out of line
|
||||
*/
|
||||
public boolean isOutOfLine(final StringListCharPosition position)
|
||||
{
|
||||
|
@ -1070,9 +1111,11 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Checks if is out of list.
|
||||
*
|
||||
* @param position
|
||||
* @return
|
||||
* the position
|
||||
* @return true, if is out of list
|
||||
*/
|
||||
public boolean isOutOfList(final StringListCharPosition position)
|
||||
{
|
||||
|
@ -1099,7 +1142,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* Iterator of char.
|
||||
*
|
||||
* @return the iterator
|
||||
*/
|
||||
public Iterator<Character> iteratorOfChar()
|
||||
{
|
||||
|
@ -1114,6 +1159,8 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
/**
|
||||
* Returns the length of the string list concatenation. Null strings are
|
||||
* ignored.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
@Override
|
||||
public int length()
|
||||
|
@ -1137,7 +1184,7 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
* operation, the new string is the first of the list and the size list is
|
||||
* 1.
|
||||
*
|
||||
* @return
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList merge()
|
||||
{
|
||||
|
@ -1402,11 +1449,15 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param prefix
|
||||
* the prefix
|
||||
* @param separator
|
||||
* @param postifx
|
||||
* @return
|
||||
* the separator
|
||||
* @param postfix
|
||||
* the postfix
|
||||
* @return the string
|
||||
*/
|
||||
public String toString(final String prefix, final String separator, final String postfix)
|
||||
{
|
||||
|
@ -1439,7 +1490,7 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
* Returns an array containing all of the strings in this list in proper
|
||||
* sequence (from first to last element).
|
||||
*
|
||||
* @return
|
||||
* @return the string[]
|
||||
*/
|
||||
public String[] toStringArray()
|
||||
{
|
||||
|
@ -1462,8 +1513,8 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
* concatenated too.
|
||||
*
|
||||
* @param separator
|
||||
*
|
||||
* @return
|
||||
* the separator
|
||||
* @return the string
|
||||
*/
|
||||
public String toStringSeparatedBy(final String separator)
|
||||
{
|
||||
|
@ -1489,9 +1540,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @return the string
|
||||
*/
|
||||
public String toStringWithBracket()
|
||||
{
|
||||
|
@ -1504,9 +1555,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with brackets.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* @return the string
|
||||
*/
|
||||
public String toStringWithBrackets()
|
||||
{
|
||||
|
@ -1526,8 +1577,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with commas.
|
||||
*
|
||||
* @return
|
||||
* @return the string
|
||||
*/
|
||||
public String toStringWithCommas()
|
||||
{
|
||||
|
@ -1540,8 +1592,9 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with french commas.
|
||||
*
|
||||
* @return
|
||||
* @return the string
|
||||
*/
|
||||
public String toStringWithFrenchCommas()
|
||||
{
|
||||
|
@ -1558,8 +1611,8 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
*
|
||||
* @param out
|
||||
* The {@code PrintWriter} where to write.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public void writeInto(final java.io.PrintWriter out) throws IOException
|
||||
{
|
||||
|
@ -1574,8 +1627,8 @@ public class StringList extends ArrayList<String> implements CharSequence
|
|||
*
|
||||
* @param out
|
||||
* The {@code Writer} where to write.
|
||||
*
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public void writeInto(final java.io.Writer out) throws IOException
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2014-2015 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
/*
|
||||
* Copyright (C) 2014-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
*
|
||||
|
@ -22,16 +21,18 @@ package fr.devinsy.util.strings;
|
|||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Class StringListCharIterator.
|
||||
*/
|
||||
public class StringListCharIterator implements Iterator<Character>
|
||||
{
|
||||
private StringList source;
|
||||
private StringListCharPosition currentPosition;
|
||||
private StringListCharPosition nextPosition;
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string list char iterator.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringListCharIterator(final StringList source)
|
||||
{
|
||||
|
@ -41,8 +42,8 @@ public class StringListCharIterator implements Iterator<Character>
|
|||
this.nextPosition = new StringListCharPosition();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.Iterator#hasNext()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
|
@ -69,8 +70,8 @@ public class StringListCharIterator implements Iterator<Character>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.Iterator#next()
|
||||
*/
|
||||
@Override
|
||||
public Character next()
|
||||
|
@ -110,8 +111,9 @@ public class StringListCharIterator implements Iterator<Character>
|
|||
}
|
||||
|
||||
/**
|
||||
* Next position.
|
||||
*
|
||||
* @return
|
||||
* @return the string list char position
|
||||
*/
|
||||
public StringListCharPosition nextPosition()
|
||||
{
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2013-2015 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
/*
|
||||
* Copyright (C) 2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
*
|
||||
|
@ -31,10 +30,7 @@ public class StringListCharPosition
|
|||
private int localCharIndex;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param index
|
||||
* @param stringIndex
|
||||
* @param localIndex
|
||||
* Instantiates a new string list char position.
|
||||
*/
|
||||
public StringListCharPosition()
|
||||
{
|
||||
|
@ -44,10 +40,14 @@ public class StringListCharPosition
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list char position.
|
||||
*
|
||||
* @param index
|
||||
* the index
|
||||
* @param stringIndex
|
||||
* the string index
|
||||
* @param localIndex
|
||||
* the local index
|
||||
*/
|
||||
public StringListCharPosition(final int index, final int stringIndex, final int localIndex)
|
||||
{
|
||||
|
@ -57,8 +57,10 @@ public class StringListCharPosition
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list char position.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringListCharPosition(final StringListCharPosition source)
|
||||
{
|
||||
|
@ -67,46 +69,84 @@ public class StringListCharPosition
|
|||
this.localCharIndex = source.getLocalCharIndex();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the char index.
|
||||
*
|
||||
* @return the char index
|
||||
*/
|
||||
public int getCharIndex()
|
||||
{
|
||||
return this.charIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the local char index.
|
||||
*
|
||||
* @return the local char index
|
||||
*/
|
||||
public int getLocalCharIndex()
|
||||
{
|
||||
return this.localCharIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string index.
|
||||
*
|
||||
* @return the string index
|
||||
*/
|
||||
public int getStringIndex()
|
||||
{
|
||||
return this.stringIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Next.
|
||||
*/
|
||||
public void next()
|
||||
{
|
||||
this.charIndex += 1;
|
||||
this.localCharIndex += 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Next end of line.
|
||||
*/
|
||||
public void nextEndOfLine()
|
||||
{
|
||||
this.localCharIndex = 0;
|
||||
this.stringIndex += 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the char index.
|
||||
*
|
||||
* @param charIndex
|
||||
* the new char index
|
||||
*/
|
||||
public void setCharIndex(final int charIndex)
|
||||
{
|
||||
this.charIndex = charIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the local char index.
|
||||
*
|
||||
* @param localCharIndex
|
||||
* the new local char index
|
||||
*/
|
||||
public void setLocalCharIndex(final int localCharIndex)
|
||||
{
|
||||
this.localCharIndex = localCharIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the string index.
|
||||
*
|
||||
* @param stringIndex
|
||||
* the new string index
|
||||
*/
|
||||
public void setStringIndex(final int stringIndex)
|
||||
{
|
||||
this.stringIndex = stringIndex;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2013-2015 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
/*
|
||||
* Copyright (C) 2013-2015,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
*
|
||||
|
@ -23,14 +22,14 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* TODO CREATION STEP.
|
||||
* The Class StringListInputStream.
|
||||
*/
|
||||
public class StringListInputStream extends InputStream
|
||||
{
|
||||
private StringList in;
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string list input stream.
|
||||
*/
|
||||
public StringListInputStream()
|
||||
{
|
||||
|
@ -38,7 +37,10 @@ public class StringListInputStream extends InputStream
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list input stream.
|
||||
*
|
||||
* @param size
|
||||
* the size
|
||||
*/
|
||||
public StringListInputStream(final int size)
|
||||
{
|
||||
|
@ -46,7 +48,10 @@ public class StringListInputStream extends InputStream
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list input stream.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringListInputStream(final StringList source)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -23,6 +23,7 @@ import java.io.IOException;
|
|||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
* The Class StringListReader.
|
||||
*
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
|
@ -32,8 +33,10 @@ public class StringListReader extends Reader
|
|||
private StringListCharIterator iterator;
|
||||
|
||||
/**
|
||||
* Instantiates a new string list reader.
|
||||
*
|
||||
* @param in
|
||||
* the in
|
||||
*/
|
||||
public StringListReader(final StringList in)
|
||||
{
|
||||
|
@ -41,16 +44,16 @@ public class StringListReader extends Reader
|
|||
this.iterator = new StringListCharIterator(in);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Reader#close()
|
||||
*/
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Reader#read(char[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public synchronized int read(final char[] cbuf, final int off, final int len) throws IOException
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2013-2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -22,14 +22,14 @@ import java.io.IOException;
|
|||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
*
|
||||
* The Class StringListWriter.
|
||||
*/
|
||||
public class StringListWriter extends Writer
|
||||
{
|
||||
private StringList out;
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string list writer.
|
||||
*/
|
||||
public StringListWriter()
|
||||
{
|
||||
|
@ -37,7 +37,10 @@ public class StringListWriter extends Writer
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list writer.
|
||||
*
|
||||
* @param initialCapacity
|
||||
* the initial capacity
|
||||
*/
|
||||
public StringListWriter(final int initialCapacity)
|
||||
{
|
||||
|
@ -45,7 +48,10 @@ public class StringListWriter extends Writer
|
|||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new string list writer.
|
||||
*
|
||||
* @param target
|
||||
* the target
|
||||
*/
|
||||
public StringListWriter(final StringList target)
|
||||
{
|
||||
|
@ -59,6 +65,9 @@ public class StringListWriter extends Writer
|
|||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Writer#close()
|
||||
*/
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
@ -68,6 +77,9 @@ public class StringListWriter extends Writer
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Writer#flush()
|
||||
*/
|
||||
/*
|
||||
*
|
||||
*/
|
||||
|
@ -77,8 +89,8 @@ public class StringListWriter extends Writer
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
|
@ -92,8 +104,9 @@ public class StringListWriter extends Writer
|
|||
}
|
||||
|
||||
/**
|
||||
* To string list.
|
||||
*
|
||||
* @return
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList toStringList()
|
||||
{
|
||||
|
@ -105,16 +118,21 @@ public class StringListWriter extends Writer
|
|||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/**
|
||||
* Write.
|
||||
*
|
||||
* @param c
|
||||
* the c
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public void write(final char c) throws IOException
|
||||
{
|
||||
this.out.append(c);
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Writer#write(char[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public void write(final char[] cbuf, final int off, final int len) throws IOException
|
||||
|
@ -137,8 +155,8 @@ public class StringListWriter extends Writer
|
|||
this.out.append(new String(target));
|
||||
}
|
||||
|
||||
/*
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.io.Writer#write(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void write(final String string) throws IOException
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2014-2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -31,7 +31,7 @@ public class StringSet extends HashSet<String>
|
|||
private static final long serialVersionUID = 6674838743930005326L;
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string set.
|
||||
*/
|
||||
public StringSet()
|
||||
{
|
||||
|
@ -43,6 +43,7 @@ public class StringSet extends HashSet<String>
|
|||
* they are returned by the collection's iterator.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringSet(final Collection<String> source)
|
||||
{
|
||||
|
@ -59,7 +60,10 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string set.
|
||||
*
|
||||
* @param initialCapacity
|
||||
* the initial capacity
|
||||
*/
|
||||
public StringSet(final int initialCapacity)
|
||||
{
|
||||
|
@ -67,7 +71,10 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string set.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringSet(final String[] source)
|
||||
{
|
||||
|
@ -84,7 +91,10 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Instantiates a new string set.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public StringSet(final StringSet source)
|
||||
{
|
||||
|
@ -102,6 +112,10 @@ public class StringSet extends HashSet<String>
|
|||
|
||||
/**
|
||||
* Check null parameter before add.
|
||||
*
|
||||
* @param string
|
||||
* the string
|
||||
* @return true, if successful
|
||||
*/
|
||||
@Override
|
||||
public boolean add(final String string)
|
||||
|
@ -124,7 +138,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds the.
|
||||
*
|
||||
* @param strings
|
||||
* the strings
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet add(final StringSet strings)
|
||||
{
|
||||
|
@ -148,7 +166,7 @@ public class StringSet extends HashSet<String>
|
|||
* Deep copy and shallow copy have no sense about a list of immutable
|
||||
* objects.
|
||||
*
|
||||
* @return
|
||||
* @return the string set
|
||||
*/
|
||||
@Override
|
||||
public StringSet clone()
|
||||
|
@ -167,7 +185,9 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Length.
|
||||
*
|
||||
* @return the int
|
||||
*/
|
||||
public int length()
|
||||
{
|
||||
|
@ -183,7 +203,9 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Merge.
|
||||
*
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet merge()
|
||||
{
|
||||
|
@ -207,7 +229,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param character
|
||||
* the character
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final char character)
|
||||
{
|
||||
|
@ -222,7 +248,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final double value)
|
||||
{
|
||||
|
@ -235,7 +265,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final int value)
|
||||
{
|
||||
|
@ -248,7 +282,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final long value)
|
||||
{
|
||||
|
@ -261,7 +299,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final Object value)
|
||||
{
|
||||
|
@ -280,6 +322,10 @@ public class StringSet extends HashSet<String>
|
|||
|
||||
/**
|
||||
* Check null parameter before add.
|
||||
*
|
||||
* @param string
|
||||
* the string
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final String string)
|
||||
{
|
||||
|
@ -297,7 +343,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param strings
|
||||
* the strings
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final String... strings)
|
||||
{
|
||||
|
@ -318,7 +368,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param strings
|
||||
* the strings
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final StringList strings)
|
||||
{
|
||||
|
@ -339,7 +393,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put.
|
||||
*
|
||||
* @param strings
|
||||
* the strings
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet put(final StringSet strings)
|
||||
{
|
||||
|
@ -360,7 +418,11 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* Put nullable.
|
||||
*
|
||||
* @param value
|
||||
* the value
|
||||
* @return the string set
|
||||
*/
|
||||
public StringSet putNullable(final Object value)
|
||||
{
|
||||
|
@ -381,8 +443,8 @@ public class StringSet extends HashSet<String>
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.AbstractCollection#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString()
|
||||
|
@ -396,8 +458,9 @@ public class StringSet extends HashSet<String>
|
|||
}
|
||||
|
||||
/**
|
||||
* To string list.
|
||||
*
|
||||
* @return
|
||||
* @return the string list
|
||||
*/
|
||||
public StringList toStringList()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
/**
|
||||
* Copyright (C) 2008-2010 Christian Pierre MOMON
|
||||
* Copyright (C) 2013-2016 Christian Pierre MOMON
|
||||
* Copyright (C) 2017 Christian Pierre MOMON
|
||||
/*
|
||||
* Copyright (C) 2008-2010,2013-2016,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
*
|
||||
|
@ -40,15 +38,14 @@ import org.apache.commons.lang3.StringUtils;
|
|||
* The {@code StringUtils} class defines helper methods to string collection.
|
||||
*
|
||||
* Operations that are null safe.
|
||||
*
|
||||
*/
|
||||
public class StringstUtils
|
||||
{
|
||||
public static final String DEFAULT_CHARSET_NAME = "UTF-8";
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Instantiates a new stringst utils.
|
||||
*/
|
||||
private StringstUtils()
|
||||
{
|
||||
}
|
||||
|
@ -92,10 +89,9 @@ public class StringstUtils
|
|||
*
|
||||
* @param source
|
||||
* The string to concatenate several time.
|
||||
*
|
||||
* @param multiplier
|
||||
* The number of concatenate to produce.
|
||||
* @return
|
||||
* @return the string
|
||||
*/
|
||||
public static String concatenate(final String source, final int multiplier)
|
||||
{
|
||||
|
@ -108,9 +104,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains blank.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsBlank(final Collection<String> source)
|
||||
{
|
||||
|
@ -134,9 +132,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains blank.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsBlank(final String... source)
|
||||
{
|
||||
|
@ -156,9 +156,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains empty.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsEmpty(final Collection<String> source)
|
||||
{
|
||||
|
@ -182,9 +184,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains empty.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsEmpty(final String... source)
|
||||
{
|
||||
|
@ -204,9 +208,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains null.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsNull(final Collection<String> source)
|
||||
{
|
||||
|
@ -230,9 +236,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Contains null.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return true, if successful
|
||||
*/
|
||||
public static boolean containsNull(final String... source)
|
||||
{
|
||||
|
@ -370,9 +378,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the complement.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @param alpha
|
||||
* the alpha
|
||||
* @param bravo
|
||||
* the bravo
|
||||
* @return the complement
|
||||
*/
|
||||
public static StringSet getComplement(final Collection<String> alpha, final Collection<String> bravo)
|
||||
{
|
||||
|
@ -385,9 +397,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the difference.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @param alpha
|
||||
* the alpha
|
||||
* @param bravo
|
||||
* the bravo
|
||||
* @return the difference
|
||||
*/
|
||||
public static StringSet getDifference(final Collection<String> alpha, final Collection<String> bravo)
|
||||
{
|
||||
|
@ -401,9 +417,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the disjunction.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @param alpha
|
||||
* the alpha
|
||||
* @param bravo
|
||||
* the bravo
|
||||
* @return the disjunction
|
||||
*/
|
||||
public static StringSet getDisjunction(final Collection<String> alpha, final Collection<String> bravo)
|
||||
{
|
||||
|
@ -432,9 +452,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the intersection of.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @param alpha
|
||||
* the alpha
|
||||
* @param bravo
|
||||
* the bravo
|
||||
* @return the intersection of
|
||||
*/
|
||||
public static StringSet getIntersectionOf(final Collection<String> alpha, final Collection<String> bravo)
|
||||
{
|
||||
|
@ -455,9 +479,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the union of.
|
||||
*
|
||||
* @param target
|
||||
* @return
|
||||
* @param alpha
|
||||
* the alpha
|
||||
* @param bravo
|
||||
* the bravo
|
||||
* @return the union of
|
||||
*/
|
||||
public static StringSet getUnionOf(final Collection<String> alpha, final Collection<String> bravo)
|
||||
{
|
||||
|
@ -475,9 +503,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
* @param file
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string list
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static StringList load(final File source) throws IOException
|
||||
{
|
||||
|
@ -490,9 +522,15 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
* @param file
|
||||
* the file
|
||||
* @param charsetName
|
||||
* the charset name
|
||||
* @return the string list
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static StringList load(final File file, final String charsetName) throws IOException
|
||||
{
|
||||
|
@ -509,10 +547,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
* @param file
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string list
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static StringList load(final URL source) throws IOException
|
||||
{
|
||||
|
@ -525,9 +566,15 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Load.
|
||||
*
|
||||
* @param file
|
||||
* @param source
|
||||
* the source
|
||||
* @param charsetName
|
||||
* the charset name
|
||||
* @return the string list
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static StringList load(final URL source, final String charsetName) throws IOException
|
||||
{
|
||||
|
@ -544,9 +591,16 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Read.
|
||||
*
|
||||
* @param file
|
||||
* @param out
|
||||
* the out
|
||||
* @param is
|
||||
* the is
|
||||
* @param charsetName
|
||||
* the charset name
|
||||
* @throws IOException
|
||||
* Signals that an I/O exception has occurred.
|
||||
*/
|
||||
public static void read(final StringList out, final InputStream is, final String charsetName) throws IOException
|
||||
{
|
||||
|
@ -592,10 +646,9 @@ public class StringstUtils
|
|||
*
|
||||
* @param source
|
||||
* The string to concatenate several time.
|
||||
*
|
||||
* @param multiplier
|
||||
* The number of concatenate to produce.
|
||||
* @return
|
||||
* @return the string list
|
||||
*/
|
||||
public static StringList repeat(final String source, final int multiplier)
|
||||
{
|
||||
|
@ -612,10 +665,16 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* Save.
|
||||
*
|
||||
* @param file
|
||||
* @throws FileNotFoundException
|
||||
* the file
|
||||
* @param source
|
||||
* the source
|
||||
* @throws UnsupportedEncodingException
|
||||
* the unsupported encoding exception
|
||||
* @throws FileNotFoundException
|
||||
* the file not found exception
|
||||
*/
|
||||
public static void save(final File file, final StringList source) throws UnsupportedEncodingException, FileNotFoundException
|
||||
{
|
||||
|
@ -681,11 +740,17 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @param prefix
|
||||
* the prefix
|
||||
* @param separator
|
||||
* the separator
|
||||
* @param postfix
|
||||
* @return
|
||||
* the postfix
|
||||
* @return the string
|
||||
*/
|
||||
public static String toString(final String[] source, final String prefix, final String separator, final String postfix)
|
||||
{
|
||||
|
@ -705,11 +770,17 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @param prefix
|
||||
* the prefix
|
||||
* @param separator
|
||||
* the separator
|
||||
* @param postfix
|
||||
* @return
|
||||
* the postfix
|
||||
* @return the string
|
||||
*/
|
||||
public static String toString(final StringList source, final String prefix, final String separator, final String postfix)
|
||||
{
|
||||
|
@ -781,9 +852,8 @@ public class StringstUtils
|
|||
/**
|
||||
* Concatenates the string from an array to a string.
|
||||
*
|
||||
* @param strings
|
||||
* The string array to convert.
|
||||
*
|
||||
* @param source
|
||||
* the source
|
||||
* @return If argument is null then returns an empty string, otherwise
|
||||
* returns a string concatenation of the argument.
|
||||
*/
|
||||
|
@ -803,9 +873,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string separated by.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @param separator
|
||||
* the separator
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringSeparatedBy(final Collection<String> source, final String separator)
|
||||
{
|
||||
|
@ -825,9 +899,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string separated by.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @param separator
|
||||
* the separator
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringSeparatedBy(final String[] source, final String separator)
|
||||
{
|
||||
|
@ -847,9 +925,13 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string separated by.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @param separator
|
||||
* the separator
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringSeparatedBy(final StringList source, final String separator)
|
||||
{
|
||||
|
@ -869,9 +951,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracket(final Collection<String> source)
|
||||
{
|
||||
|
@ -891,9 +975,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracket(final String[] source)
|
||||
{
|
||||
|
@ -913,9 +999,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracket(final StringList source)
|
||||
{
|
||||
|
@ -935,9 +1023,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket not null.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracketNotNull(final Collection<String> source)
|
||||
{
|
||||
|
@ -955,9 +1045,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket not null.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracketNotNull(final String[] source)
|
||||
{
|
||||
|
@ -975,9 +1067,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with bracket not null.
|
||||
*
|
||||
* @param strings
|
||||
* @return
|
||||
* @param source
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBracketNotNull(final StringList source)
|
||||
{
|
||||
|
@ -995,9 +1089,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with brackets.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBrackets(final Collection<String> source)
|
||||
{
|
||||
|
@ -1017,9 +1113,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with brackets.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBrackets(final String[] source)
|
||||
{
|
||||
|
@ -1039,9 +1137,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with brackets.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithBrackets(final StringList source)
|
||||
{
|
||||
|
@ -1061,9 +1161,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithCommas(final Collection<String> source)
|
||||
{
|
||||
|
@ -1083,9 +1185,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithCommas(final String[] source)
|
||||
{
|
||||
|
@ -1105,9 +1209,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithCommas(final StringList source)
|
||||
{
|
||||
|
@ -1127,9 +1233,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with french commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithFrenchCommas(final Collection<String> source)
|
||||
{
|
||||
|
@ -1149,9 +1257,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with french commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithFrenchCommas(final String[] source)
|
||||
{
|
||||
|
@ -1171,9 +1281,11 @@ public class StringstUtils
|
|||
}
|
||||
|
||||
/**
|
||||
* To string with french commas.
|
||||
*
|
||||
* @param source
|
||||
* @return
|
||||
* the source
|
||||
* @return the string
|
||||
*/
|
||||
public static String toStringWithFrenchCommas(final StringList source)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2013,2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -28,15 +28,16 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The Class StringListTest.
|
||||
*
|
||||
* @author Christian P. Momon
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class StringListTest
|
||||
{
|
||||
static protected org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringListTest.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* Before.
|
||||
*/
|
||||
@Before
|
||||
public void before()
|
||||
|
@ -46,8 +47,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test char at 01.
|
||||
*/
|
||||
@Test
|
||||
public void testCharAt01()
|
||||
{
|
||||
|
@ -75,8 +76,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test char at 02.
|
||||
*/
|
||||
@Test
|
||||
public void testCharAt02()
|
||||
{
|
||||
|
@ -108,8 +109,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test char at exception 01.
|
||||
*/
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testCharAtException01()
|
||||
{
|
||||
|
@ -129,8 +130,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test char at exception 02.
|
||||
*/
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testCharAtException02()
|
||||
{
|
||||
|
@ -150,8 +151,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test char at exception 03.
|
||||
*/
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void testCharAtException03()
|
||||
{
|
||||
|
@ -171,8 +172,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test constructor 01.
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor01()
|
||||
{
|
||||
|
@ -191,8 +192,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test constructor 02.
|
||||
*/
|
||||
@Test
|
||||
public void testConstructor02()
|
||||
{
|
||||
|
@ -209,8 +210,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test iterator of char 01.
|
||||
*/
|
||||
@Test
|
||||
public void testIteratorOfChar01()
|
||||
{
|
||||
|
@ -245,7 +246,7 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Test substring 01.
|
||||
*/
|
||||
@Test
|
||||
public void testSubstring01()
|
||||
|
@ -266,7 +267,7 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Test substring 02.
|
||||
*/
|
||||
@Test
|
||||
public void testSubstring02()
|
||||
|
@ -287,6 +288,7 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
* Test substring 03.
|
||||
*/
|
||||
@Test
|
||||
public void testSubstring03()
|
||||
|
@ -307,6 +309,7 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
* Test substring 04.
|
||||
*/
|
||||
@Test
|
||||
public void testSubstring04()
|
||||
|
@ -327,8 +330,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test to string 01.
|
||||
*/
|
||||
@Test
|
||||
public void testToString01()
|
||||
{
|
||||
|
@ -347,8 +350,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test to string 02.
|
||||
*/
|
||||
@Test
|
||||
public void testToString02()
|
||||
{
|
||||
|
@ -371,8 +374,8 @@ public class StringListTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test to string 03.
|
||||
*/
|
||||
@Test
|
||||
public void testToString03()
|
||||
{
|
||||
|
@ -394,5 +397,4 @@ public class StringListTest
|
|||
//
|
||||
logger.debug("===== test done.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Copyright (C) 2013,2014,2017 Christian Pierre MOMON
|
||||
*
|
||||
* This file is part of devinsy-strings.
|
||||
|
@ -29,15 +29,17 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* The Class StringsUtilsTest.
|
||||
*
|
||||
* @author Christian P. Momon
|
||||
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
|
||||
*/
|
||||
public class StringsUtilsTest
|
||||
{
|
||||
|
||||
private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringsUtilsTest.class);
|
||||
|
||||
/**
|
||||
*
|
||||
* Before.
|
||||
*/
|
||||
@Before
|
||||
public void before()
|
||||
|
@ -47,8 +49,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains blank 01.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsBlank01()
|
||||
{
|
||||
|
@ -60,8 +62,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains blank 02.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsBlank02()
|
||||
{
|
||||
|
@ -73,8 +75,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains blank 03.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsBlank03()
|
||||
{
|
||||
|
@ -93,8 +95,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains empty 01.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsEmpty01()
|
||||
{
|
||||
|
@ -105,8 +107,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains empty 02.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsEmpty02()
|
||||
{
|
||||
|
@ -117,8 +119,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains empty 03.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsEmpty03()
|
||||
{
|
||||
|
@ -135,8 +137,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains null 01.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsNull01()
|
||||
{
|
||||
|
@ -146,8 +148,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains null 02.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsNull02()
|
||||
{
|
||||
|
@ -157,8 +159,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test contains null 03.
|
||||
*/
|
||||
@Test
|
||||
public void testContainsNull03()
|
||||
{
|
||||
|
@ -173,8 +175,8 @@ public class StringsUtilsTest
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
* Test find smallest 01.
|
||||
*/
|
||||
@Test
|
||||
public void testFindSmallest01()
|
||||
{
|
||||
|
@ -188,5 +190,4 @@ public class StringsUtilsTest
|
|||
source.set(1, null);
|
||||
Assert.assertTrue(StringstUtils.containsNull(source));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue