[LANG-1626] Correction in Javadoc of some methods. (#673)
1) Found Javadoc examples in ArrayUtils.addFirst() incorrectly refer to add() at 9 places. 2) Basic code format in 3 files from time package.
This commit is contained in:
parent
55e0776408
commit
efbfd2de97
|
@ -1099,9 +1099,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, true) = [true]
|
||||
* ArrayUtils.add([true], false) = [false, true]
|
||||
* ArrayUtils.add([true, false], true) = [true, true, false]
|
||||
* ArrayUtils.addFirst(null, true) = [true]
|
||||
* ArrayUtils.addFirst([true], false) = [false, true]
|
||||
* ArrayUtils.addFirst([true, false], true) = [true, true, false]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1128,9 +1128,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1157,9 +1157,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, '1') = ['1']
|
||||
* ArrayUtils.add(['1'], '0') = ['0', '1']
|
||||
* ArrayUtils.add(['1', '0'], '1') = ['1', '1', '0']
|
||||
* ArrayUtils.addFirst(null, '1') = ['1']
|
||||
* ArrayUtils.addFirst(['1'], '0') = ['0', '1']
|
||||
* ArrayUtils.addFirst(['1', '0'], '1') = ['1', '1', '0']
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1186,9 +1186,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1215,9 +1215,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1244,9 +1244,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1273,9 +1273,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1302,9 +1302,9 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, 1) = [1]
|
||||
* ArrayUtils.add([1], 0) = [0, 1]
|
||||
* ArrayUtils.add([1, 0], 1) = [1, 1, 0]
|
||||
* ArrayUtils.addFirst(null, 1) = [1]
|
||||
* ArrayUtils.addFirst([1], 0) = [0, 1]
|
||||
* ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0]
|
||||
* </pre>
|
||||
*
|
||||
* @param array the array to "add" the element to, may be {@code null}.
|
||||
|
@ -1331,11 +1331,11 @@ public class ArrayUtils {
|
|||
* </p>
|
||||
*
|
||||
* <pre>
|
||||
* ArrayUtils.add(null, null) = IllegalArgumentException
|
||||
* ArrayUtils.add(null, "a") = ["a"]
|
||||
* ArrayUtils.add(["a"], null) = [null, "a"]
|
||||
* ArrayUtils.add(["a"], "b") = ["b", "a"]
|
||||
* ArrayUtils.add(["a", "b"], "c") = ["c", "a", "b"]
|
||||
* ArrayUtils.addFirst(null, null) = IllegalArgumentException
|
||||
* ArrayUtils.addFirst(null, "a") = ["a"]
|
||||
* ArrayUtils.addFirst(["a"], null) = [null, "a"]
|
||||
* ArrayUtils.addFirst(["a"], "b") = ["b", "a"]
|
||||
* ArrayUtils.addFirst(["a", "b"], "c") = ["c", "a", "b"]
|
||||
* </pre>
|
||||
*
|
||||
* @param <T> the component type of the array
|
||||
|
|
|
@ -99,7 +99,7 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
*/
|
||||
public static final int SHORT = DateFormat.SHORT;
|
||||
|
||||
private static final FormatCache<FastDateFormat> cache= new FormatCache<FastDateFormat>() {
|
||||
private static final FormatCache<FastDateFormat> cache = new FormatCache<FastDateFormat>() {
|
||||
@Override
|
||||
protected FastDateFormat createInstance(final String pattern, final TimeZone timeZone, final Locale locale) {
|
||||
return new FastDateFormat(pattern, timeZone, locale);
|
||||
|
@ -395,8 +395,8 @@ public class FastDateFormat extends Format implements DateParser, DatePrinter {
|
|||
* @throws NullPointerException if pattern, timeZone, or locale is null.
|
||||
*/
|
||||
protected FastDateFormat(final String pattern, final TimeZone timeZone, final Locale locale, final Date centuryStart) {
|
||||
printer= new FastDatePrinter(pattern, timeZone, locale);
|
||||
parser= new FastDateParser(pattern, timeZone, locale, centuryStart);
|
||||
printer = new FastDatePrinter(pattern, timeZone, locale);
|
||||
parser = new FastDateParser(pattern, timeZone, locale, centuryStart);
|
||||
}
|
||||
|
||||
// Format methods
|
||||
|
|
|
@ -132,16 +132,16 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
int centuryStartYear;
|
||||
if (centuryStart!=null) {
|
||||
definingCalendar.setTime(centuryStart);
|
||||
centuryStartYear= definingCalendar.get(Calendar.YEAR);
|
||||
centuryStartYear = definingCalendar.get(Calendar.YEAR);
|
||||
} else if (locale.equals(JAPANESE_IMPERIAL)) {
|
||||
centuryStartYear= 0;
|
||||
centuryStartYear = 0;
|
||||
} else {
|
||||
// from 80 years ago to 20 years from now
|
||||
definingCalendar.setTime(new Date());
|
||||
centuryStartYear= definingCalendar.get(Calendar.YEAR)-80;
|
||||
centuryStartYear = definingCalendar.get(Calendar.YEAR)-80;
|
||||
}
|
||||
century= centuryStartYear / 100 * 100;
|
||||
startYear= centuryStartYear - century;
|
||||
century = centuryStartYear / 100 * 100;
|
||||
startYear = centuryStartYear - century;
|
||||
|
||||
init(definingCalendar);
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
@Override
|
||||
public Date parse(final String source) throws ParseException {
|
||||
final ParsePosition pp = new ParsePosition(0);
|
||||
final Date date= parse(source, pp);
|
||||
final Date date = parse(source, pp);
|
||||
if (date == null) {
|
||||
// Add a note re supported date range
|
||||
if (locale.equals(JAPANESE_IMPERIAL)) {
|
||||
|
@ -387,7 +387,7 @@ public class FastDateParser implements DateParser, Serializable {
|
|||
@Override
|
||||
public Date parse(final String source, final ParsePosition pos) {
|
||||
// timing tests indicate getting new instance is 19% faster than cloning
|
||||
final Calendar cal= Calendar.getInstance(timeZone, locale);
|
||||
final Calendar cal = Calendar.getInstance(timeZone, locale);
|
||||
cal.clear();
|
||||
|
||||
return parse(source, pos, cal) ? cal.getTime() : null;
|
||||
|
|
|
@ -38,7 +38,7 @@ abstract class FormatCache<F extends Format> {
|
|||
/**
|
||||
* No date or no time. Used in same parameters as DateFormat.SHORT or DateFormat.LONG
|
||||
*/
|
||||
static final int NONE= -1;
|
||||
static final int NONE = -1;
|
||||
|
||||
private final ConcurrentMap<MultipartKey, F> cInstanceCache
|
||||
= new ConcurrentHashMap<>(7);
|
||||
|
@ -80,11 +80,11 @@ abstract class FormatCache<F extends Format> {
|
|||
F format = cInstanceCache.get(key);
|
||||
if (format == null) {
|
||||
format = createInstance(pattern, timeZone, locale);
|
||||
final F previousValue= cInstanceCache.putIfAbsent(key, format);
|
||||
final F previousValue = cInstanceCache.putIfAbsent(key, format);
|
||||
if (previousValue != null) {
|
||||
// another thread snuck in and did the same work
|
||||
// we should return the instance that is in ConcurrentMap
|
||||
format= previousValue;
|
||||
format = previousValue;
|
||||
}
|
||||
}
|
||||
return format;
|
||||
|
@ -207,7 +207,7 @@ abstract class FormatCache<F extends Format> {
|
|||
// even though it doesn't matter if another thread put the pattern
|
||||
// it's still good practice to return the String instance that is
|
||||
// actually in the ConcurrentMap
|
||||
pattern= previous;
|
||||
pattern = previous;
|
||||
}
|
||||
} catch (final ClassCastException ex) {
|
||||
throw new IllegalArgumentException("No date time pattern for locale: " + locale);
|
||||
|
@ -248,14 +248,14 @@ abstract class FormatCache<F extends Format> {
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (hashCode==0) {
|
||||
int rc= 0;
|
||||
if (hashCode == 0) {
|
||||
int rc = 0;
|
||||
for (final Object key : keys) {
|
||||
if (key!=null) {
|
||||
rc= rc*7 + key.hashCode();
|
||||
if (key != null) {
|
||||
rc = rc * 7 + key.hashCode();
|
||||
}
|
||||
}
|
||||
hashCode= rc;
|
||||
hashCode = rc;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue