Posts

Showing posts from July, 2025

Mutable List of Float, Immutable List of Float, Revisited

 This code seems to work! package net.coderextreme; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import java.util.Collections; import java.lang.Float; public class NoModFloatArray { public  static final List<Float> FIELDOFVIEW_DEFAULT_VALUE = Collections.unmodifiableList(List.of(-1f,-1f,1f,1f)); public void print(String section, List<Float> MOD_FIELDOFVIEW) { System.out.println(); System.out.println(section); System.out.println("Immutable Array FIELDOFVIEW_DEFAULT_VALUE "+FIELDOFVIEW_DEFAULT_VALUE); System.out.println("Mutable Array MOD_FIELDOFVIEW"+MOD_FIELDOFVIEW); System.out.println("Compare mutable to immutable "+MOD_FIELDOFVIEW.equals(FIELDOFVIEW_DEFAULT_VALUE)); System.out.println(); } public NoModFloatArray() { List<Float> MOD_FIELDOFVIEW = new ArrayList<Float>(FIELDOFVIEW_DEFAULT_VALUE); print("Modify Pre Immutable Change", MOD_FIELDOFVIEW); try { ...

Mutable List of Float, Immutable List of Float

This code fails to maintain the integrity of the default value. package net.coderextreme; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import java.util.Collections; import java.lang.Float; public class NoModFloatArray { private static final ArrayList<Float> FLOAT_ARRAY_FIELDOFVIEW_DEFAULT_VALUE = new ArrayList<Float>(Arrays.asList(-1f,-1f,1f,1f)); public  static final List<Float> FIELDOFVIEW_DEFAULT_VALUE = Collections.unmodifiableList(FLOAT_ARRAY_FIELDOFVIEW_DEFAULT_VALUE); public void print(String section, List<Float> MOD_FIELDOFVIEW) { System.out.println(); System.out.println(section); System.out.println("Immutable Array FIELDOFVIEW_DEFAULT_VALUE "+FIELDOFVIEW_DEFAULT_VALUE); System.out.println("Mutable Array MOD_FIELDOFVIEW"+MOD_FIELDOFVIEW); System.out.println("Compare mutable to immutable "+MOD_FIELDOFVIEW.equals(FIELDOFVIEW_DEFAULT_VALUE)); System.out.println(); } pub...

Mutable double Arrays, Immutable List of Double in Java

Demo of mutable double arrays an immutable Double Lists. Works, AFAICT package net.coderextreme; import java.util.ArrayList; import java.util.List; import java.util.Arrays; import java.util.Collections; import java.lang.Double; public class NoModDoubleArray { private static final double[] DOUBLE_ARRAY_FIELDOFVIEW_DEFAULT_VALUE = new double [] {-1f,-1f,1f,1f}; public static final List<Double> FIELDOFVIEW_DEFAULT_VALUE = Collections.unmodifiableList(Arrays.asList(Arrays.stream(DOUBLE_ARRAY_FIELDOFVIEW_DEFAULT_VALUE).boxed().toArray(Double[]::new))); public void print(String section, List<Double> MOD_FIELDOFVIEW) { System.out.println(); System.out.println(section); System.out.println("Immutable Array FIELDOFVIEW_DEFAULT_VALUE "+FIELDOFVIEW_DEFAULT_VALUE); System.out.println("Mutable Array MOD_FIELDOFVIEW"+MOD_FIELDOFVIEW); System.out.println("Compare mutable to immutable "+MOD_FIELDOFVIEW.equals(FIELDOFVIEW_DEFAULT_VALUE)); ...

Meaning of Ex3D Lax

This is merely my exile blog from the X3D-public mailing list.  I may cross-post occasionally, but this blog is designed for composing many messages together and posting a single, coherent message.