Home > Java, NB Platform, NetBeans > Fastest way to clear the Lookup contents

Fastest way to clear the Lookup contents

Suppose you have an AbstractLookup with a registered InstanceContent:

InstanceContent ic = new InstanceContent();
Lookup lkp = new AbstractLookup(ic);

The fastest way to clear all the Lookup contents:

ic.set(Collections.emptyList(), null);

Now I’m looking for a convenience command to remove all instances of a given type. I want to replace this code:

for (MyClass my : lkp.lookupAll(MyClass.class)) {  
   ic.remove(my);
}

Perhaps someone has an idea?

Advertisements
Categories: Java, NB Platform, NetBeans Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: