Over a million developers have joined DZone.

NetBeans IDE's Cool New "Inspect & Transform" Feature

DZone's Guide to

NetBeans IDE's Cool New "Inspect & Transform" Feature

· Java Zone
Free Resource

Microservices! They are everywhere, or at least, the term is. When should you use a microservice architecture? What factors should be considered when making that decision? Do the benefits outweigh the costs? Why is everyone so excited about them, anyway?  Brought to you in partnership with IBM.

I've been using NetBeas IDE for 10+ years now and I know I've spent a lot more time griping about product bugs and lack of features than I've spent giving thanks. And it's definitely not because there isn't plenty to be thankful for!

For instance, I just discovered a feature that was added in NetBeans IDE 7.1: "Inspect and Transform". Wow! NetBeans IDE has always had a good number of refactorings and plenty of editor hints, but it hadn't previously brought the two together to let one fix/refactor many/all of the hinted shortcomings en masse.

We have a fairly large source base (about 4000 Java files) that's accumulated cruft & inefficiencies over the past 10 years and getting it back in good shape is a challenge. We're using the PMD plugin to avoid future source commits from containing these shortcomings, but it doesn't help much with fixing existing code.

With "Inspect and Transform", I just replaced 1,500 instances of




...with two clicks of a button!

I also just replaced 15 inefficient loop-based List fills with


Then I replaced 7812 instances where our code mixed String concatenation with StringBuffer/Builder.append(), such as:

stringBuilder.append("hello ").append(var1 + " " + var2)

instead of

stringBuilder.append("hello").append(var1).append(' ').append(var2))…

And there are a couple dozen more transforms I have yet to try… amazingly easy. Great job, NetBeans Team!

Developing isn't just about writing cool new features. It's also a lot of refactoring and rejigging to adapt software over time.

Thanks to NetBeans for making that job a bit easier!

Discover how the Watson team is further developing SDKs in Java, Node.js, Python, iOS, and Android to access these services and make programming easy. Brought to you in partnership with IBM.


Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}