Skip to content

io microsphere collection ImmutableEntry

github-actions[bot] edited this page Mar 21, 2026 · 1 revision

ImmutableEntry

Type: Class | Module: microsphere-java-core | Package: io.microsphere.collection

Source: microsphere-java-core/src/main/java/io/microsphere/collection/ImmutableEntry.java

Overview

An immutable implementation of Map.Entry that stores a fixed key-value pair.

This class provides a read-only entry suitable for use in immutable maps. Once created, the key and value cannot be changed, and calling #setValue(Object) will throw an UnsupportedOperationException.

Example Usage

`ImmutableEntry entry = ImmutableEntry.of("age", 30);
System.out.println(entry.getKey());   // Output: age
System.out.println(entry.getValue()); // Output: 30

// The following line would throw an exception:
// entry.setValue(25); // throws UnsupportedOperationException
`

Declaration

public class ImmutableEntry<K, V> extends DefaultEntry<K, V>

Version Information

  • Introduced in: 0.1.10-SNAPSHOT (current)
  • Current Project Version: 0.1.10-SNAPSHOT

Version Compatibility

This component is tested and compatible with the following Java versions:

Java Version Status
Java 8 ✅ Compatible
Java 11 ✅ Compatible
Java 17 ✅ Compatible
Java 21 ✅ Compatible
Java 25 ✅ Compatible

Examples

ImmutableEntry<String, Integer> entry = ImmutableEntry.of("age", 30);
System.out.println(entry.getKey());   // Output: age
System.out.println(entry.getValue()); // Output: 30

// The following line would throw an exception:
// entry.setValue(25); // throws UnsupportedOperationException

Usage

Maven Dependency

Add the following dependency to your pom.xml:

<dependency>
    <groupId>io.github.microsphere-projects</groupId>
    <artifactId>microsphere-java-core</artifactId>
    <version>${microsphere-java.version}</version>
</dependency>

Tip: Use the BOM (microsphere-java-dependencies) for consistent version management. See the Getting Started guide.

Import

import io.microsphere.collection.ImmutableEntry;

API Reference

Public Methods

Method Description
setValue

See Also

  • MapUtils#ofEntry(Object, Object)
  • MapUtils#immutableEntry(Object, Object)

This documentation was auto-generated from the source code of microsphere-java.

Home

java-annotations

java-core

jdk-tools

lang-model

annotation-processor

java-test

Clone this wiki locally