Novice Tutorial Tools use (11)--eclipse Remove unused references

Source: Internet
Author: User

When you write code, you often see the following:

Everyone knows that this is due to the introduction of unused packages, so eclipse gives hints to tell you that these are useless references that affect aesthetics, increase the amount of space the code occupies, and add a burden to the compilation of the code. So for these useless code, we should remove it. Let's take a look at three ways to get rid of useless references.


The first type: Remove the

When an unused reference exists in a class, the shortcut key ctrl+shift+o is used to remove it, primarily for a small number of classes.


The second type: Remove the entire package from the

When there are many classes in a package, or a few packages that have unused references, it is obviously very cumbersome to use the first method, when we can take the bulk operation. Under Package Explorer, right-click on the pack name and select Source--organize imports.


Third: automatic removal when saving

If you are a very lazy person and obsessive-compulsive like me, then you can only use this method. Can one step, once and for all. Let you get rid of this obsession completely (how does it sound like a TV ad?) ). just a few steps to open Windows--preferences--java--editor--save Actions,

Then select perform the selected action on save and tick organize imports:


OK, finish the call, and Eclipse will help you get rid of unused references every time you save the code. Constantly accumulate the use of software skills, so that our tools become more intelligent, more understanding of your heart.


Novice Tutorial Tools use (11)--eclipse Remove unused references

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.