Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
Collections:
Other Resources:
Jackson Data Binding Source Code
Jackson is "the Java JSON library" or "the best JSON parser for Java". Or simply as "JSON for Java".
Jackson Databind Source Code files are provided in the source packge (jackson-databind-2.14.0-sources.jar). You can download it at Jackson Maven Website.
You can also browse Jackson Databind Source Code below:
✍: FYIcenter.com
⏎ com/fasterxml/jackson/databind/util/CompactStringObjectMap.java
package com.fasterxml.jackson.databind.util; import java.util.*; /** * Specialized lookup class that implements functionality similar to * {@link java.util.Map}, but for special case of key always being * {@link java.lang.String} and using more compact (and memory-access * friendly) hashing scheme. Assumption is also that keys are typically * intern()ed. *<p> * Generics are not used to avoid bridge methods and since these maps * are not exposed as part of external API. * * @since 2.6 */ public final class CompactStringObjectMap implements java.io.Serializable // since 2.6.2 { private static final long serialVersionUID = 1L; /** * Shared instance that can be used when there are no contents to Map. */ private final static CompactStringObjectMap EMPTY = new CompactStringObjectMap(1, 0, new Object[4]); private final int _hashMask, _spillCount; private final Object[] _hashArea; private CompactStringObjectMap(int hashMask, int spillCount, Object[] hashArea) { _hashMask = hashMask; _spillCount = spillCount; _hashArea = hashArea; } public static <T> CompactStringObjectMap construct(Map<String,T> all) { if (all.isEmpty()) { // can this happen? return EMPTY; } // First: calculate size of primary hash area final int size = findSize(all.size()); final int mask = size-1; // and allocate enough to contain primary/secondary, expand for spillovers as need be int alloc = (size + (size>>1)) * 2; Object[] hashArea = new Object[alloc]; int spillCount = 0; for (Map.Entry<String,T> entry : all.entrySet()) { String key = entry.getKey(); // 09-Sep-2019, tatu: [databind#2309] skip `null`s if any included if (key == null) { continue; } int slot = key.hashCode() & mask; int ix = slot+slot; // primary slot not free? if (hashArea[ix] != null) { // secondary? ix = (size + (slot >> 1)) << 1; if (hashArea[ix] != null) { // ok, spill over. ix = ((size + (size >> 1) ) << 1) + spillCount; spillCount += 2; if (ix >= hashArea.length) { hashArea = Arrays.copyOf(hashArea, hashArea.length + 4); } } } hashArea[ix] = key; hashArea[ix+1] = entry.getValue(); } return new CompactStringObjectMap(mask, spillCount, hashArea); } private final static int findSize(int size) { if (size <= 5) { return 8; } if (size <= 12) { return 16; } int needed = size + (size >> 2); // at most 80% full int result = 32; while (result < needed) { result += result; } return result; } public Object find(String key) { int slot = key.hashCode() & _hashMask; int ix = (slot<<1); Object match = _hashArea[ix]; if ((match == key) || key.equals(match)) { return _hashArea[ix+1]; } return _find2(key, slot, match); } private final Object _find2(String key, int slot, Object match) { if (match == null) { return null; } int hashSize = _hashMask+1; int ix = (hashSize + (slot>>1)) << 1; match = _hashArea[ix]; if (key.equals(match)) { return _hashArea[ix+1]; } if (match != null) { // _findFromSpill(...) int i = (hashSize + (hashSize>>1)) << 1; for (int end = i + _spillCount; i < end; i += 2) { match = _hashArea[i]; if ((match == key) || key.equals(match)) { return _hashArea[i+1]; } } } return null; } // @since 2.9 public Object findCaseInsensitive(String key) { for (int i = 0, end = _hashArea.length; i < end; i += 2) { Object k2 = _hashArea[i]; if (k2 != null) { String s = (String) k2; if (s.equalsIgnoreCase(key)) { return _hashArea[i+1]; // lgtm [java/index-out-of-bounds] } } } return null; } public List<String> keys() { final int end = _hashArea.length; List<String> keys = new ArrayList<String>(end >> 2); for (int i = 0; i < end; i += 2) { Object key = _hashArea[i]; if (key != null) { keys.add((String) key); } } return keys; } }
⏎ com/fasterxml/jackson/databind/util/CompactStringObjectMap.java
Or download all of them as a single archive file:
File name: jackson-databind-2.14.0-sources.jar File size: 1187952 bytes Release date: 2022-11-05 Download
⇒ Jackson Annotations Source Code
⇐ Download and Install Jackson Binary Package
2022-03-29, 109427👍, 0💬
Popular Posts:
Provides support for the runtime platform, core utility methods and the extension registry. JAR File...
JDK 11 jdk.rmic.jmod is the JMOD file for JDK 11 RMI (Remote Method Invocation) Compiler Tool tool, ...
Java Cryptography Extension 1.2.2 JAR File Size and Download Location: File name: jce.jar, jce-1.2.2...
What Is jms.jar? I heard it's related to JMS (Java Message Service) 1.1? The if you have an jms.jar ...
JDK 11 jdk.hotspot.agent.jmod is the JMOD file for JDK 11 Hotspot Agent module. JDK 11 Hotspot Agent...