Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 java.base.jmod - Base Module
JDK 17 java.base.jmod is the JMOD file for JDK 17 Base module.
JDK 17 Base module compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\java.base.jmod.
JDK 17 Base module compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 Base module source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\java.base.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ java/util/concurrent/Helpers.java
/*
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
/*
*
*
*
*
*
* Written by Martin Buchholz with assistance from members of JCP
* JSR-166 Expert Group and released to the public domain, as
* explained at http://creativecommons.org/publicdomain/zero/1.0/
*/
package java.util.concurrent;
import java.util.Collection;
/** Shared implementation code for java.util.concurrent. */
class Helpers {
private Helpers() {} // non-instantiable
/**
* An implementation of Collection.toString() suitable for classes
* with locks. Instead of holding a lock for the entire duration of
* toString(), or acquiring a lock for each call to Iterator.next(),
* we hold the lock only during the call to toArray() (less
* disruptive to other threads accessing the collection) and follows
* the maxim "Never call foreign code while holding a lock".
*/
static String collectionToString(Collection<?> c) {
final Object[] a = c.toArray();
final int size = a.length;
if (size == 0)
return "[]";
int charLength = 0;
// Replace every array element with its string representation
for (int i = 0; i < size; i++) {
Object e = a[i];
// Extreme compatibility with AbstractCollection.toString()
String s = (e == c) ? "(this Collection)" : objectToString(e);
a[i] = s;
charLength += s.length();
}
return toString(a, size, charLength);
}
/**
* Like Arrays.toString(), but caller guarantees that size > 0,
* each element with index 0 <= i < size is a non-null String,
* and charLength is the sum of the lengths of the input Strings.
*/
static String toString(Object[] a, int size, int charLength) {
// assert a != null;
// assert size > 0;
// Copy each string into a perfectly sized char[]
// Length of [ , , , ] == 2 * size
final char[] chars = new char[charLength + 2 * size];
chars[0] = '[';
int j = 1;
for (int i = 0; i < size; i++) {
if (i > 0) {
chars[j++] = ',';
chars[j++] = ' ';
}
String s = (String) a[i];
int len = s.length();
s.getChars(0, len, chars, j);
j += len;
}
chars[j] = ']';
// assert j == chars.length - 1;
return new String(chars);
}
/** Optimized form of: key + "=" + val */
static String mapEntryToString(Object key, Object val) {
final String k, v;
final int klen, vlen;
final char[] chars =
new char[(klen = (k = objectToString(key)).length()) +
(vlen = (v = objectToString(val)).length()) + 1];
k.getChars(0, klen, chars, 0);
chars[klen] = '=';
v.getChars(0, vlen, chars, klen + 1);
return new String(chars);
}
private static String objectToString(Object x) {
// Extreme compatibility with StringBuilder.append(null)
String s;
return (x == null || (s = x.toString()) == null) ? "null" : s;
}
}
⏎ java/util/concurrent/Helpers.java
Or download all of them as a single archive file:
File name: java.base-17.0.5-src.zip File size: 8883851 bytes Release date: 2022-09-13 Download
2023-09-26, ≈923🔥, 1💬
Popular Posts:
ANTLR is a powerful parser generator for multiple programming languages including Java. ANTLR contai...
JDK 17 jdk.internal.opt.jmod is the JMOD file for JDK 17 Internal Opt module. JDK 17 Internal Opt mo...
What Is js.jar in Rhino JavaScript 1.7R5? js.jar in Rhino JavaScript 1.7R5 is the JAR file for Rhino...
maven-model-builder-3.8. 6.jaris the JAR file for Apache Maven 3.8.6 Model Builder module. Apache Ma...
How to download and install JDK (Java Development Kit) 6? If you want to write Java applications, yo...