From 9185ec02c5d814ae22bed7d2348650fb1bbf7ec8 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Sat, 26 Oct 2024 16:34:40 +0000 Subject: immutable maps git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1921575 13f79535-47bb-0310-9956-ffa450edef68 --- .../java/org/apache/poi/xdgf/usermodel/section/GeometryRowTypes.java | 5 +++-- .../java/org/apache/poi/xdgf/usermodel/section/XDGFSectionTypes.java | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'poi-ooxml/src') diff --git a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/GeometryRowTypes.java b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/GeometryRowTypes.java index 7dd4641107..4c64af53fd 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/GeometryRowTypes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/GeometryRowTypes.java @@ -17,6 +17,7 @@ package org.apache.poi.xdgf.usermodel.section; +import java.util.Collections; import java.util.Map; import java.util.function.Function; import java.util.stream.Collectors; @@ -84,6 +85,6 @@ enum GeometryRowTypes { return l.constructor.apply(row); } - private static final Map LOOKUP = - Stream.of(values()).collect(Collectors.toMap(GeometryRowTypes::getRowType, Function.identity())); + private static final Map LOOKUP = Collections.unmodifiableMap( + Stream.of(values()).collect(Collectors.toMap(GeometryRowTypes::getRowType, Function.identity()))); } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/XDGFSectionTypes.java b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/XDGFSectionTypes.java index 35af8d52be..887dfa0333 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/XDGFSectionTypes.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xdgf/usermodel/section/XDGFSectionTypes.java @@ -17,6 +17,7 @@ package org.apache.poi.xdgf.usermodel.section; +import java.util.Collections; import java.util.Map; import java.util.function.BiFunction; import java.util.function.Function; @@ -72,6 +73,6 @@ enum XDGFSectionTypes { return l.constructor.apply(section, containingSheet); } - private static final Map LOOKUP = - Stream.of(values()).collect(Collectors.toMap(XDGFSectionTypes::getSectionType, Function.identity())); + private static final Map LOOKUP = Collections.unmodifiableMap( + Stream.of(values()).collect(Collectors.toMap(XDGFSectionTypes::getSectionType, Function.identity()))); } -- cgit v1.2.3