Code Monkey home page Code Monkey logo

java-record's Introduction

🚩 Java Record Class

Java'da "record" sınıfı, Java 16 ve sonrasındaki sürümlerde eklenen bir özelliktir. Record sınıfları, veri taşıma amacıyla kullanılır ve genellikle basit veri nesneleri için tasarlanmıştır. Bir record sınıfı, sınıfın içerdiği verileri temsil eden ve bu verilere erişim için otomatik getter yöntemleri sağlayan bir sınıf türüdür. Ayrıca, "equals()", "hashCode()" ve "toString()" gibi ortak işlemleri otomatik olarak oluşturan özel bir sınıf türüdür.

1) Veri Taşıma: Record sınıfları, verileri gruplamak ve bu verilere erişim sağlamak için kullanılır. Örneğin, bir kullanıcıyı temsil eden bir record sınıfı, kullanıcı adı, e-posta adresi ve diğer ilgili bilgileri içerebilir.

2) Otomatik Getter Yöntemleri: Record sınıfları, her veri elemanı için otomatik olarak getter yöntemlerini oluşturur. Bu, verilere erişmek için herhangi bir ek kod yazmanız gerekmediği anlamına gelir.

3) equals() ve hashCode() Metodları: Record sınıfları, verileri karşılaştırmak için "equals()" ve "hashCode()" metodlarını otomatik olarak oluşturur. Bu, nesnelerin içeriğine dayalı karşılaştırmalar yapmayı kolaylaştırır.

4) toString() Metodu: Record sınıfları, "toString()" metodunu otomatik olarak oluşturur ve bu sayede nesnenin temsilini döndürerek hata ayıklama ve günlükleme işlemlerini kolaylaştırır.

5) İmmutability (Değiştirilemezlik): Record sınıfları, genellikle değiştirilemez nesneler olarak kullanılır. Bu nedenle, bir record nesnesi oluşturulduktan sonra içerdiği veriler değiştirilemez.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.