About 93,000 results
Open links in new tab
  1. java - Immutable class? - Stack Overflow

    Jul 2, 2010 · How can one make a Java class immutable? From JDK 14+ which has JEP 359, we can use "records". It is the simplest and hustle free way of creating Immutable class. A record …

  2. java - Examples of immutable classes - Stack Overflow

    Feb 25, 2011 · Immutable class is a class which once created, it’s contents can not be changed. Immutable objects are the objects whose state can not be changed once constructed. …

  3. java - Why do we need immutable class? - Stack Overflow

    Sep 22, 2010 · One feature of immutable classes which hasn't yet been called out: storing a reference to a deeply-immutable class object is an efficient means of storing all of the state …

  4. java - What is meant by immutable? - Stack Overflow

    Nov 11, 2008 · Why are string objects immutable in java? Because Java uses the concept of string literal. Suppose there are 5 reference variables, all refers to one object "Future".If one …

  5. How to create immutable class in java - Stack Overflow

    Dec 25, 2013 · First we need to discussed what is immutable in java. In Java immutable means you state does not change once it has been initialize. the best example of immutable class is …

  6. How to make an immutable class in Java? - Stack Overflow

    May 9, 2018 · Java SE 16. You can use JEP 395: Records feature, introduced as part of Java SE 16, to create an immutable class without requiring much ceremony. If you have already gone …

  7. java - How to Create Immutable Class with List<String> Element in …

    Oct 21, 2019 · Immutable Class with List package com.text.immutable; import java.util.Collections; import java.util.List; // An immutable class Student public final class …

  8. How to create immutable objects in Java? - Stack Overflow

    Jun 10, 2011 · Immutable Objects are those objects whose state can not be changed once they are created, for example the String class is an immutable class. Immutable objects can not be …

  9. java - How can we maintain Immutability of a class with a mutable ...

    A thread-safe immutable object is seen as immutable by all threads, even if a data race is used to pass references to the immutable object between threads. This can provide safety guarantees …

  10. Java Immutable Collections - Stack Overflow

    Now java 9 has factory Methods for Immutable List, Set, Map and Map.Entry . In Java SE 8 and earlier versions, We can use Collections class utility methods like unmodifiableXXX to create …

Refresh