Git Product home page Git Product logo

effectivejava's Introduction

EffectiveJava

对EffectiveJava第三版进行的demo分析与使用测试的项目,目的是为了帮助学习理解EffectiveJava的代码介绍

注意:本项目pxpy代表书本对应页数Px-Py页

#目录

创建与销毁

p4p7:静态工厂替代构造器(内含单例模式)

使用情景:需要灵活使用javaBean,需要javaBean对象唯一,如果要防止序列化,反射机制妨碍对象的唯一性,建议使用枚举类型实现

p8p13:使用建造者模式创建javaBean

使用情景:类的构造器或静态工厂中具有多个参数

p15p16:让类无法被外界实例化

使用情景:如工具类等需要强调类不能被实例化,一般使用方式是直接调用内部静态方法

P19-P20:

  • 关于创建不必要对象建议:1.当你应该重用现有对象的时候,请不要创建新的对象。2.当你因果创建新的对象的时候,请不要重用现有对象。 注意:位于循环内的自动装箱对象容易出现重复创建新对象的情况,应该使用基本类型,避免该情况

effectivejava's People

Contributors

413889948 avatar

Stargazers

 avatar

Watchers

 avatar

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.