org.kopitubruk.util.json.FixedPseudoMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of JSONUtil Show documentation
Show all versions of JSONUtil Show documentation
A library for generating JSON
The newest version!
/*
* Copyright 2016 Bill Davidson
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.kopitubruk.util.json;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/**
* This class implements a fake map of fixed size that doesn't do any real
* mapping. Its purpose is to provide an ordered collection of key-value pairs
* via the entrySet() method so that it can be used to build JSON objects using
* the same code that builds them from real maps. It is meant to be faster than
* doing normal put and iteration operations and to save memory compared to
* normal maps. The gains tend to be effectively marginal but they are
* measurable with objects that have large numbers of fields to be serialized.
*
* @author Bill Davidson
*/
class FixedPseudoMap extends AbstractPseudoMap
{
private final Map.Entry