简体   繁体   中英

Which one is better on performane between lombok builder and lombok no//allargsconstructor annotation

Which one is better in peformance comparing between lombok builder and lombok no//allargsconstructor annotation when creating objects?

Amount.builder().categoryCode("A").coveredAmount(new 
BigDecimal(100)).build();

or

Amount cva1 = new Amount();
cva1.setCoveredAmount(new BigDecimal(100));
cva1.setCategoryCode("A");

or

Amount cva1 = new Amount(new Bigdecimal(100), "A");

Lombok is a compile-time-only tool and so has nothing to do with runtime performance.

It is an annotation processor that run during the java compilation javac .

Here you only want to compare creational patterns but it not something "link" to Lombok.

By the way it is opinion-based

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM