You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Gary Gregory <ga...@gmail.com> on 2016/01/12 02:04:58 UTC
List vs. Set
Should APIs like:
org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
really return a List instead of a Set?
Gary
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by sampath kumar <sa...@gmail.com>.
If you want to have Back ward compatibility i think API should expose only*
Immutable Iterable* to outside. Internal Data Structure can vary depending
on the functionality or performance point of view.
On Wed, Jan 13, 2016 at 6:20 AM, Ralph Goers <ra...@dslextreme.com>
wrote:
> We run on Java 7 Matt.
>
> Ralph
>
> On Jan 12, 2016, at 4:14 PM, Matt Sicker <bo...@gmail.com> wrote:
>
> Java 8 added a neat shortcut for that, too:
> http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#newKeySet--
>
> On 12 January 2016 at 17:06, Swor, Steve <St...@team.telstra.com>
> wrote:
>
>> eep... I always forget that there's no ConcurrentHashSet. However you
>> can get one via Collections.newSetFromMap(new ConcurrentHashMap())
>> On 13/01/16 10:04, Swor, Steve wrote:
>> > My thoughts based on the conversation so far:
>> >
>> > 1. How important is it to expose the duplicates/ordering semantics in
>> the public API? My preference is to keep it as loose/flexible as possible
>> (e.g. use Collection unless there is a specific reason to narrow it further
>> in the public API).
>> >
>> > As far as choosing the implementation, I've come up with a brief
>> decision tree which should (hopefully) help.
>> >
>> > Must prevent duplicates?
>> > No:
>> > ......Must be thread-safe?
>> > ......Yes: use CopyOnWriteArrayList
>> > ......No: use ArrayList
>> > Yes:
>> > ......Must be thread-safe?
>> > ......No:
>> > ............Must be ordered?
>> > ............No: use HashSet
>> > ............Yes:
>> > ..................Must preserve the order in which objects were added?
>> > ..................No: use TreeSet
>> > ..................Yes: use LinkedHashSet
>> > ....Yes:
>> > ...........Must be ordered?
>> > ...........No: use ConcurrentHashSet
>> > ...........Yes:
>> > .................Must preserve the order in which objects were added?
>> > .................No: use ConcurrentSkipListSet
>> > .................Yes: use CopyOnWriteArraySet
>> >
>> > Cheers,
>> > Steve
>> >
>> >
>> > On 13/01/16 07:03, Matt Sicker wrote:
>> > What about NavigableSet? ;)
>> >
>> > On 12 January 2016 at 13:57, Gary Gregory <garydgregory@gmail.com
>> <ma...@gmail.com>> wrote:
>> > For completeness' sake: A set can also be ordered:
>> https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
>> >
>> > Gary
>> >
>> > On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <<mailto:
>> mikael.staldal@magine.com>mikael.staldal@magine.com<mailto:
>> mikael.staldal@magine.com>> wrote:
>> > List is a Collection with the additional semantics of being ordered.
>> Set is a Collection with the additional semantics of having no duplicates.
>> >
>> > So is the order of the plugins significant? If not it should be
>> Collection or Iterable (or possibly Set) rather than List. If the order is
>> significant, we should keep it as List.
>> >
>> > On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <
>> mikael.staldal@magine.com<ma...@magine.com>> wrote:
>> > If you want it more generic, it should be Iterable rather than Iterator.
>> >
>> > On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <<mailto:
>> sampath088@gmail.com>sampath088@gmail.com<ma...@gmail.com>>
>> wrote:
>> > You Can still achieve enhanced for loop using iterator by using
>> following modification.
>> >
>> > I apologize if this thread going in different context. We can go with
>> either List or Set depending on the Requirement.
>> >
>> > Code Snippet:
>> >
>> > import java.util.HashSet;
>> > import java.util.Iterator;
>> > import java.util.Set;
>> >
>> > public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>> >
>> > static class Plugin {
>> > String name;
>> > Plugin(String name) {
>> > this.name<http://this.name> = name;
>> > }
>> > public String toString() {
>> > return "Plugin{" + name + "}";
>> > }
>> > }
>> >
>> > Set<Plugin> set = new HashSet<Plugin>();
>> >
>> > public void addPenguin(Plugin p) {
>> > set.add(p);
>> > }
>> >
>> > public Iterator<Plugin> getPlugins() {
>> > return set.iterator();
>> > }
>> >
>> > public Iterator<Plugin> iterator() {
>> > return getPlugins();
>> > }
>> >
>> > public static void main(String args[]) {
>> > PluginIterator pluginIterators = new PluginIterator();
>> > Plugin plugin1 = new Plugin("Plugin-1");
>> > Plugin plugin2 = new Plugin("Plugin-2");
>> > Plugin plugin3 = new Plugin("Plugin-3");
>> > Plugin plugin4 = new Plugin("Plugin-4");
>> > pluginIterators.addPenguin(plugin1);
>> > pluginIterators.addPenguin(plugin2);
>> > pluginIterators.addPenguin(plugin3);
>> > pluginIterators.addPenguin(plugin4);
>> > for (Plugin p : pluginIterators) {
>> > System.out.println(p);
>> > }
>> > }
>> > }
>> >
>> > On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <<mailto:
>> garydgregory@gmail.com>garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com>> wrote:
>> > I dislike this iterator business very much, and you can't use it in a
>> for each loop.
>> >
>> > Gary
>> >
>> > On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <<mailto:
>> sampath088@gmail.com>sampath088@gmail.com<ma...@gmail.com>>
>> wrote:
>> > How about this, Unmodifiable Iterator
>> >
>> > Iterator<String> getPluginPackages();
>> >
>> > On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <<mailto:
>> garydgregory@gmail.com>garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com>> wrote:
>> > List<String> getPluginPackages();
>> >
>> > G
>> >
>> > On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <<mailto:
>> pbenedict@apache.org>pbenedict@apache.org<ma...@apache.org>>
>> wrote:
>> >
>> > Thu can only use Set if you have a notion of equality and comparison.
>> Do you for this collection?
>> >
>> > On Jan 11, 2016 9:48 PM, "Gary Gregory" <<mailto:garydgregory@gmail.com
>> >garydgregory@gmail.com<ma...@gmail.com>> wrote:
>> > Well, not really, I'd like to express whether the collection allows for
>> duplicates or not, if not, use a set.
>> >
>> > Gary
>> >
>> > On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <<m...@gmail.com>
>> boards@gmail.com<ma...@gmail.com>> wrote:
>> > Even a Collection works well for this.
>> >
>> >
>> > On Monday, 11 January 2016, Gary Gregory <<mailto:
>> garydgregory@gmail.com>garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com>> wrote:
>> > On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>> ralph.goers@dslextreme.com<ma...@dslextreme.com>> wrote:
>> > It is returning a List already. Does it really matter much?
>> >
>> > It is not indeed critical. It's just a finer point of declaring the
>> intention of the data model, either duplicates are allowed and expected, or
>> not.
>> >
>> > Gary
>> >
>> > Ralph
>> >
>> > On Jan 11, 2016, at 6:04 PM, Gary Gregory <garydgregory@gmail.com
>> <ma...@gmail.com>> wrote:
>> >
>> > Should APIs like:
>> >
>> > org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>> >
>> > really return a List instead of a Set?
>> >
>> > Gary
>> >
>> > --
>> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> |
>> ggregory@apache.org<ma...@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: <http://garygregory.wordpress.com/>
>> http://garygregory.wordpress.com
>> > Home: <http://garygregory.com/> http://garygregory.com/
>> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>> >
>> >
>> >
>> >
>> > --
>> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> |
>> ggregory@apache.org<ma...@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: <http://garygregory.wordpress.com/>
>> http://garygregory.wordpress.com
>> > Home: <http://garygregory.com/> http://garygregory.com/
>> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>> >
>> >
>> > --
>> > Matt Sicker <<m...@gmail.com>boards@gmail.com<mailto:
>> boards@gmail.com>>
>> >
>> >
>> >
>> > --
>> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com> | <ma...@apache.org>
>> ggregory@apache.org<ma...@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: <http://garygregory.wordpress.com/>
>> http://garygregory.wordpress.com
>> > Home: <http://garygregory.com/> http://garygregory.com/
>> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>> >
>> >
>> >
>> > --
>> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com> | <ma...@apache.org>
>> ggregory@apache.org<ma...@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: <http://garygregory.wordpress.com/>
>> http://garygregory.wordpress.com
>> > Home: <http://garygregory.com/> http://garygregory.com/
>> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>> >
>> >
>> >
>> > --
>> > Regards,
>> > Sampath
>> >
>> >
>> >
>> > --
>> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
>> garydgregory@gmail.com> | <ma...@apache.org>
>> ggregory@apache.org<ma...@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: <http://garygregory.wordpress.com/>
>> http://garygregory.wordpress.com
>> > Home: <http://garygregory.com/> http://garygregory.com/
>> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>> >
>> >
>> >
>> > --
>> > Regards,
>> > Sampath
>> >
>> >
>> >
>> > --
>> >
>> >
>> > Mikael Ståldal
>> > Senior software developer
>> >
>> > Magine TV
>> > <ma...@magine.com>mikael.staldal@magine.com<mailto:
>> mikael.staldal@magine.com>
>> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <
>> http://www.magine.com/> www.magine.com<http://www.magine.com>
>> >
>> > Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> > (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> > you should destroy this message and kindly notify the sender by reply
>> email.
>> >
>> >
>> >
>> > --
>> >
>> >
>> > Mikael Ståldal
>> > Senior software developer
>> >
>> > Magine TV
>> > <ma...@magine.com>mikael.staldal@magine.com<mailto:
>> mikael.staldal@magine.com>
>> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <
>> http://www.magine.com/> www.magine.com<http://www.magine.com>
>> >
>> > Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> > (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> > you should destroy this message and kindly notify the sender by reply
>> email.
>> >
>> >
>> >
>> > --
>> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> |
>> <ma...@apache.org> ggregory@apache.org<mailto:
>> ggregory@apache.org>
>> > Java Persistence with Hibernate, Second Edition<
>> http://www.manning.com/bauer3/>
>> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
>> > Spring Batch in Action<http://www.manning.com/templier/>
>> > Blog: http://garygregory.wordpress.com<
>> http://garygregory.wordpress.com/>
>> > Home: http://garygregory.com/
>> > Tweet! http://twitter.com/GaryGregory
>> >
>> >
>> >
>> > --
>> > Matt Sicker <<m...@gmail.com>boards@gmail.com<mailto:
>> boards@gmail.com>>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>
>
>
--
Regards,
Sampath
Re: List vs. Set
Posted by Ralph Goers <ra...@dslextreme.com>.
We run on Java 7 Matt.
Ralph
> On Jan 12, 2016, at 4:14 PM, Matt Sicker <bo...@gmail.com> wrote:
>
> Java 8 added a neat shortcut for that, too: http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#newKeySet-- <http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#newKeySet-->
>
> On 12 January 2016 at 17:06, Swor, Steve <Steve.Swor@team.telstra.com <ma...@team.telstra.com>> wrote:
> eep... I always forget that there's no ConcurrentHashSet. However you
> can get one via Collections.newSetFromMap(new ConcurrentHashMap())
> On 13/01/16 10:04, Swor, Steve wrote:
> > My thoughts based on the conversation so far:
> >
> > 1. How important is it to expose the duplicates/ordering semantics in the public API? My preference is to keep it as loose/flexible as possible (e.g. use Collection unless there is a specific reason to narrow it further in the public API).
> >
> > As far as choosing the implementation, I've come up with a brief decision tree which should (hopefully) help.
> >
> > Must prevent duplicates?
> > No:
> > ......Must be thread-safe?
> > ......Yes: use CopyOnWriteArrayList
> > ......No: use ArrayList
> > Yes:
> > ......Must be thread-safe?
> > ......No:
> > ............Must be ordered?
> > ............No: use HashSet
> > ............Yes:
> > ..................Must preserve the order in which objects were added?
> > ..................No: use TreeSet
> > ..................Yes: use LinkedHashSet
> > ....Yes:
> > ...........Must be ordered?
> > ...........No: use ConcurrentHashSet
> > ...........Yes:
> > .................Must preserve the order in which objects were added?
> > .................No: use ConcurrentSkipListSet
> > .................Yes: use CopyOnWriteArraySet
> >
> > Cheers,
> > Steve
> >
> >
> > On 13/01/16 07:03, Matt Sicker wrote:
> > What about NavigableSet? ;)
> >
> > On 12 January 2016 at 13:57, Gary Gregory <garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> > For completeness' sake: A set can also be ordered: https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html <https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html>
> >
> > Gary
> >
> > On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <<mailto:mikael.staldal@magine.com <ma...@magine.com>>mikael.staldal@magine.com <ma...@magine.com><mailto:mikael.staldal@magine.com <ma...@magine.com>>> wrote:
> > List is a Collection with the additional semantics of being ordered. Set is a Collection with the additional semantics of having no duplicates.
> >
> > So is the order of the plugins significant? If not it should be Collection or Iterable (or possibly Set) rather than List. If the order is significant, we should keep it as List.
> >
> > On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <mikael.staldal@magine.com <ma...@magine.com><mailto:mikael.staldal@magine.com <ma...@magine.com>>> wrote:
> > If you want it more generic, it should be Iterable rather than Iterator.
> >
> > On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <<mailto:sampath088@gmail.com <ma...@gmail.com>>sampath088@gmail.com <ma...@gmail.com><mailto:sampath088@gmail.com <ma...@gmail.com>>> wrote:
> > You Can still achieve enhanced for loop using iterator by using following modification.
> >
> > I apologize if this thread going in different context. We can go with either List or Set depending on the Requirement.
> >
> > Code Snippet:
> >
> > import java.util.HashSet;
> > import java.util.Iterator;
> > import java.util.Set;
> >
> > public class PluginIterator implements Iterable<PluginIterator.Plugin> {
> >
> > static class Plugin {
> > String name;
> > Plugin(String name) {
> > this.name <http://this.name/><http://this.name <http://this.name/>> = name;
> > }
> > public String toString() {
> > return "Plugin{" + name + "}";
> > }
> > }
> >
> > Set<Plugin> set = new HashSet<Plugin>();
> >
> > public void addPenguin(Plugin p) {
> > set.add(p);
> > }
> >
> > public Iterator<Plugin> getPlugins() {
> > return set.iterator();
> > }
> >
> > public Iterator<Plugin> iterator() {
> > return getPlugins();
> > }
> >
> > public static void main(String args[]) {
> > PluginIterator pluginIterators = new PluginIterator();
> > Plugin plugin1 = new Plugin("Plugin-1");
> > Plugin plugin2 = new Plugin("Plugin-2");
> > Plugin plugin3 = new Plugin("Plugin-3");
> > Plugin plugin4 = new Plugin("Plugin-4");
> > pluginIterators.addPenguin(plugin1);
> > pluginIterators.addPenguin(plugin2);
> > pluginIterators.addPenguin(plugin3);
> > pluginIterators.addPenguin(plugin4);
> > for (Plugin p : pluginIterators) {
> > System.out.println(p);
> > }
> > }
> > }
> >
> > On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <<mailto:garydgregory@gmail.com <ma...@gmail.com>>garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> > I dislike this iterator business very much, and you can't use it in a for each loop.
> >
> > Gary
> >
> > On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <<mailto:sampath088@gmail.com <ma...@gmail.com>>sampath088@gmail.com <ma...@gmail.com><mailto:sampath088@gmail.com <ma...@gmail.com>>> wrote:
> > How about this, Unmodifiable Iterator
> >
> > Iterator<String> getPluginPackages();
> >
> > On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <<mailto:garydgregory@gmail.com <ma...@gmail.com>>garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> > List<String> getPluginPackages();
> >
> > G
> >
> > On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <<mailto:pbenedict@apache.org <ma...@apache.org>>pbenedict@apache.org <ma...@apache.org><mailto:pbenedict@apache.org <ma...@apache.org>>> wrote:
> >
> > Thu can only use Set if you have a notion of equality and comparison. Do you for this collection?
> >
> > On Jan 11, 2016 9:48 PM, "Gary Gregory" <<mailto:garydgregory@gmail.com <ma...@gmail.com>>garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> > Well, not really, I'd like to express whether the collection allows for duplicates or not, if not, use a set.
> >
> > Gary
> >
> > On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <<mailto:boards@gmail.com <ma...@gmail.com>>boards@gmail.com <ma...@gmail.com><mailto:boards@gmail.com <ma...@gmail.com>>> wrote:
> > Even a Collection works well for this.
> >
> >
> > On Monday, 11 January 2016, Gary Gregory <<mailto:garydgregory@gmail.com <ma...@gmail.com>>garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> > On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ralph.goers@dslextreme.com <ma...@dslextreme.com><mailto:ralph.goers@dslextreme.com <ma...@dslextreme.com>>> wrote:
> > It is returning a List already. Does it really matter much?
> >
> > It is not indeed critical. It's just a finer point of declaring the intention of the data model, either duplicates are allowed and expected, or not.
> >
> > Gary
> >
> > Ralph
> >
> > On Jan 11, 2016, at 6:04 PM, Gary Gregory <garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>>> wrote:
> >
> > Should APIs like:
> >
> > org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
> >
> > really return a List instead of a Set?
> >
> > Gary
> >
> > --
> > E-Mail: garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: <http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>> http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> > Home: <http://garygregory.com/ <http://garygregory.com/>> http://garygregory.com/ <http://garygregory.com/>
> > Tweet! <http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>> http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: <http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>> http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> > Home: <http://garygregory.com/ <http://garygregory.com/>> http://garygregory.com/ <http://garygregory.com/>
> > Tweet! <http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>> http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> > --
> > Matt Sicker <<mailto:boards@gmail.com <ma...@gmail.com>>boards@gmail.com <ma...@gmail.com><mailto:boards@gmail.com <ma...@gmail.com>>>
> >
> >
> >
> > --
> > E-Mail: <mailto:garydgregory@gmail.com <ma...@gmail.com>> garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | <mailto:ggregory@apache.org <ma...@apache.org>> ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: <http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>> http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> > Home: <http://garygregory.com/ <http://garygregory.com/>> http://garygregory.com/ <http://garygregory.com/>
> > Tweet! <http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>> http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> >
> > --
> > E-Mail: <mailto:garydgregory@gmail.com <ma...@gmail.com>> garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | <mailto:ggregory@apache.org <ma...@apache.org>> ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: <http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>> http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> > Home: <http://garygregory.com/ <http://garygregory.com/>> http://garygregory.com/ <http://garygregory.com/>
> > Tweet! <http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>> http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> >
> > --
> > Regards,
> > Sampath
> >
> >
> >
> > --
> > E-Mail: <mailto:garydgregory@gmail.com <ma...@gmail.com>> garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | <mailto:ggregory@apache.org <ma...@apache.org>> ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: <http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>> http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> > Home: <http://garygregory.com/ <http://garygregory.com/>> http://garygregory.com/ <http://garygregory.com/>
> > Tweet! <http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>> http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> >
> > --
> > Regards,
> > Sampath
> >
> >
> >
> > --
> >
> >
> > Mikael Ståldal
> > Senior software developer
> >
> > Magine TV
> > <mailto:mikael.staldal@magine.com <ma...@magine.com>>mikael.staldal@magine.com <ma...@magine.com><mailto:mikael.staldal@magine.com <ma...@magine.com>>
> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/ <http://www.magine.com/>> www.magine.com <http://www.magine.com/><http://www.magine.com <http://www.magine.com/>>
> >
> > Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply email.
> >
> >
> >
> > --
> >
> >
> > Mikael Ståldal
> > Senior software developer
> >
> > Magine TV
> > <mailto:mikael.staldal@magine.com <ma...@magine.com>>mikael.staldal@magine.com <ma...@magine.com><mailto:mikael.staldal@magine.com <ma...@magine.com>>
> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/ <http://www.magine.com/>> www.magine.com <http://www.magine.com/><http://www.magine.com <http://www.magine.com/>>
> >
> > Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply email.
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com <ma...@gmail.com><mailto:garydgregory@gmail.com <ma...@gmail.com>> | <mailto:ggregory@apache.org <ma...@apache.org>> ggregory@apache.org <ma...@apache.org><mailto:ggregory@apache.org <ma...@apache.org>>
> > Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/ <http://www.manning.com/bauer3/>>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/ <http://www.manning.com/tahchiev/>>
> > Spring Batch in Action<http://www.manning.com/templier/ <http://www.manning.com/templier/>>
> > Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/><http://garygregory.wordpress.com/ <http://garygregory.wordpress.com/>>
> > Home: http://garygregory.com/ <http://garygregory.com/>
> > Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> >
> >
> >
> > --
> > Matt Sicker <<mailto:boards@gmail.com <ma...@gmail.com>>boards@gmail.com <ma...@gmail.com><mailto:boards@gmail.com <ma...@gmail.com>>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org <ma...@logging.apache.org>
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org <ma...@logging.apache.org>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org <ma...@logging.apache.org>
> For additional commands, e-mail: log4j-dev-help@logging.apache.org <ma...@logging.apache.org>
>
>
>
>
> --
> Matt Sicker <boards@gmail.com <ma...@gmail.com>>
Re: List vs. Set
Posted by Matt Sicker <bo...@gmail.com>.
Java 8 added a neat shortcut for that, too:
http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ConcurrentHashMap.html#newKeySet--
On 12 January 2016 at 17:06, Swor, Steve <St...@team.telstra.com>
wrote:
> eep... I always forget that there's no ConcurrentHashSet. However you
> can get one via Collections.newSetFromMap(new ConcurrentHashMap())
> On 13/01/16 10:04, Swor, Steve wrote:
> > My thoughts based on the conversation so far:
> >
> > 1. How important is it to expose the duplicates/ordering semantics in
> the public API? My preference is to keep it as loose/flexible as possible
> (e.g. use Collection unless there is a specific reason to narrow it further
> in the public API).
> >
> > As far as choosing the implementation, I've come up with a brief
> decision tree which should (hopefully) help.
> >
> > Must prevent duplicates?
> > No:
> > ......Must be thread-safe?
> > ......Yes: use CopyOnWriteArrayList
> > ......No: use ArrayList
> > Yes:
> > ......Must be thread-safe?
> > ......No:
> > ............Must be ordered?
> > ............No: use HashSet
> > ............Yes:
> > ..................Must preserve the order in which objects were added?
> > ..................No: use TreeSet
> > ..................Yes: use LinkedHashSet
> > ....Yes:
> > ...........Must be ordered?
> > ...........No: use ConcurrentHashSet
> > ...........Yes:
> > .................Must preserve the order in which objects were added?
> > .................No: use ConcurrentSkipListSet
> > .................Yes: use CopyOnWriteArraySet
> >
> > Cheers,
> > Steve
> >
> >
> > On 13/01/16 07:03, Matt Sicker wrote:
> > What about NavigableSet? ;)
> >
> > On 12 January 2016 at 13:57, Gary Gregory <garydgregory@gmail.com
> <ma...@gmail.com>> wrote:
> > For completeness' sake: A set can also be ordered:
> https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
> >
> > Gary
> >
> > On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <<mailto:
> mikael.staldal@magine.com>mikael.staldal@magine.com<mailto:
> mikael.staldal@magine.com>> wrote:
> > List is a Collection with the additional semantics of being ordered. Set
> is a Collection with the additional semantics of having no duplicates.
> >
> > So is the order of the plugins significant? If not it should be
> Collection or Iterable (or possibly Set) rather than List. If the order is
> significant, we should keep it as List.
> >
> > On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <
> mikael.staldal@magine.com<ma...@magine.com>> wrote:
> > If you want it more generic, it should be Iterable rather than Iterator.
> >
> > On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <<mailto:
> sampath088@gmail.com>sampath088@gmail.com<ma...@gmail.com>>
> wrote:
> > You Can still achieve enhanced for loop using iterator by using
> following modification.
> >
> > I apologize if this thread going in different context. We can go with
> either List or Set depending on the Requirement.
> >
> > Code Snippet:
> >
> > import java.util.HashSet;
> > import java.util.Iterator;
> > import java.util.Set;
> >
> > public class PluginIterator implements Iterable<PluginIterator.Plugin> {
> >
> > static class Plugin {
> > String name;
> > Plugin(String name) {
> > this.name<http://this.name> = name;
> > }
> > public String toString() {
> > return "Plugin{" + name + "}";
> > }
> > }
> >
> > Set<Plugin> set = new HashSet<Plugin>();
> >
> > public void addPenguin(Plugin p) {
> > set.add(p);
> > }
> >
> > public Iterator<Plugin> getPlugins() {
> > return set.iterator();
> > }
> >
> > public Iterator<Plugin> iterator() {
> > return getPlugins();
> > }
> >
> > public static void main(String args[]) {
> > PluginIterator pluginIterators = new PluginIterator();
> > Plugin plugin1 = new Plugin("Plugin-1");
> > Plugin plugin2 = new Plugin("Plugin-2");
> > Plugin plugin3 = new Plugin("Plugin-3");
> > Plugin plugin4 = new Plugin("Plugin-4");
> > pluginIterators.addPenguin(plugin1);
> > pluginIterators.addPenguin(plugin2);
> > pluginIterators.addPenguin(plugin3);
> > pluginIterators.addPenguin(plugin4);
> > for (Plugin p : pluginIterators) {
> > System.out.println(p);
> > }
> > }
> > }
> >
> > On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <<mailto:
> garydgregory@gmail.com>garydgregory@gmail.com<mailto:
> garydgregory@gmail.com>> wrote:
> > I dislike this iterator business very much, and you can't use it in a
> for each loop.
> >
> > Gary
> >
> > On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <<mailto:
> sampath088@gmail.com>sampath088@gmail.com<ma...@gmail.com>>
> wrote:
> > How about this, Unmodifiable Iterator
> >
> > Iterator<String> getPluginPackages();
> >
> > On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <<mailto:
> garydgregory@gmail.com>garydgregory@gmail.com<mailto:
> garydgregory@gmail.com>> wrote:
> > List<String> getPluginPackages();
> >
> > G
> >
> > On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <<mailto:
> pbenedict@apache.org>pbenedict@apache.org<ma...@apache.org>>
> wrote:
> >
> > Thu can only use Set if you have a notion of equality and comparison. Do
> you for this collection?
> >
> > On Jan 11, 2016 9:48 PM, "Gary Gregory" <<m...@gmail.com>
> garydgregory@gmail.com<ma...@gmail.com>> wrote:
> > Well, not really, I'd like to express whether the collection allows for
> duplicates or not, if not, use a set.
> >
> > Gary
> >
> > On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <<m...@gmail.com>
> boards@gmail.com<ma...@gmail.com>> wrote:
> > Even a Collection works well for this.
> >
> >
> > On Monday, 11 January 2016, Gary Gregory <<mailto:garydgregory@gmail.com
> >garydgregory@gmail.com<ma...@gmail.com>> wrote:
> > On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ralph.goers@dslextreme.com
> <ma...@dslextreme.com>> wrote:
> > It is returning a List already. Does it really matter much?
> >
> > It is not indeed critical. It's just a finer point of declaring the
> intention of the data model, either duplicates are allowed and expected, or
> not.
> >
> > Gary
> >
> > Ralph
> >
> > On Jan 11, 2016, at 6:04 PM, Gary Gregory <garydgregory@gmail.com
> <ma...@gmail.com>> wrote:
> >
> > Should APIs like:
> >
> > org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
> >
> > really return a List instead of a Set?
> >
> > Gary
> >
> > --
> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> |
> ggregory@apache.org<ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: <http://garygregory.wordpress.com/>
> http://garygregory.wordpress.com
> > Home: <http://garygregory.com/> http://garygregory.com/
> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
> >
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> |
> ggregory@apache.org<ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: <http://garygregory.wordpress.com/>
> http://garygregory.wordpress.com
> > Home: <http://garygregory.com/> http://garygregory.com/
> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
> >
> >
> > --
> > Matt Sicker <<m...@gmail.com>boards@gmail.com<mailto:
> boards@gmail.com>>
> >
> >
> >
> > --
> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
> garydgregory@gmail.com> | <ma...@apache.org> ggregory@apache.org
> <ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: <http://garygregory.wordpress.com/>
> http://garygregory.wordpress.com
> > Home: <http://garygregory.com/> http://garygregory.com/
> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
> >
> >
> >
> > --
> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
> garydgregory@gmail.com> | <ma...@apache.org> ggregory@apache.org
> <ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: <http://garygregory.wordpress.com/>
> http://garygregory.wordpress.com
> > Home: <http://garygregory.com/> http://garygregory.com/
> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
> >
> >
> >
> > --
> > Regards,
> > Sampath
> >
> >
> >
> > --
> > E-Mail: <ma...@gmail.com> garydgregory@gmail.com<mailto:
> garydgregory@gmail.com> | <ma...@apache.org> ggregory@apache.org
> <ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: <http://garygregory.wordpress.com/>
> http://garygregory.wordpress.com
> > Home: <http://garygregory.com/> http://garygregory.com/
> > Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
> >
> >
> >
> > --
> > Regards,
> > Sampath
> >
> >
> >
> > --
> >
> >
> > Mikael Ståldal
> > Senior software developer
> >
> > Magine TV
> > <ma...@magine.com>mikael.staldal@magine.com<mailto:
> mikael.staldal@magine.com>
> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <
> http://www.magine.com/> www.magine.com<http://www.magine.com>
> >
> > Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may
> not copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply
> email.
> >
> >
> >
> > --
> >
> >
> > Mikael Ståldal
> > Senior software developer
> >
> > Magine TV
> > <ma...@magine.com>mikael.staldal@magine.com<mailto:
> mikael.staldal@magine.com>
> > Grev Turegatan 3 | 114 46 Stockholm, Sweden | <
> http://www.magine.com/> www.magine.com<http://www.magine.com>
> >
> > Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> > (or responsible for delivery of the message to such a person), you may
> not copy or deliver this message to anyone. In such case,
> > you should destroy this message and kindly notify the sender by reply
> email.
> >
> >
> >
> > --
> > E-Mail: garydgregory@gmail.com<ma...@gmail.com> | <mailto:
> ggregory@apache.org> ggregory@apache.org<ma...@apache.org>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> > Spring Batch in Action<http://www.manning.com/templier/>
> > Blog: http://garygregory.wordpress.com<http://garygregory.wordpress.com/
> >
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
> >
> >
> >
> > --
> > Matt Sicker <<m...@gmail.com>boards@gmail.com<mailto:
> boards@gmail.com>>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-dev-help@logging.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
--
Matt Sicker <bo...@gmail.com>
Re: List vs. Set
Posted by "Swor, Steve" <St...@team.telstra.com>.
eep... I always forget that there's no ConcurrentHashSet. However you
can get one via Collections.newSetFromMap(new ConcurrentHashMap())
On 13/01/16 10:04, Swor, Steve wrote:
> My thoughts based on the conversation so far:
>
> 1. How important is it to expose the duplicates/ordering semantics in the public API? My preference is to keep it as loose/flexible as possible (e.g. use Collection unless there is a specific reason to narrow it further in the public API).
>
> As far as choosing the implementation, I've come up with a brief decision tree which should (hopefully) help.
>
> Must prevent duplicates?
> No:
> ......Must be thread-safe?
> ......Yes: use CopyOnWriteArrayList
> ......No: use ArrayList
> Yes:
> ......Must be thread-safe?
> ......No:
> ............Must be ordered?
> ............No: use HashSet
> ............Yes:
> ..................Must preserve the order in which objects were added?
> ..................No: use TreeSet
> ..................Yes: use LinkedHashSet
> ....Yes:
> ...........Must be ordered?
> ...........No: use ConcurrentHashSet
> ...........Yes:
> .................Must preserve the order in which objects were added?
> .................No: use ConcurrentSkipListSet
> .................Yes: use CopyOnWriteArraySet
>
> Cheers,
> Steve
>
>
> On 13/01/16 07:03, Matt Sicker wrote:
> What about NavigableSet? ;)
>
> On 12 January 2016 at 13:57, Gary Gregory <ga...@gmail.com>> wrote:
> For completeness' sake: A set can also be ordered: https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
>
> Gary
>
> On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <<m...@magine.com>> wrote:
> List is a Collection with the additional semantics of being ordered. Set is a Collection with the additional semantics of having no duplicates.
>
> So is the order of the plugins significant? If not it should be Collection or Iterable (or possibly Set) rather than List. If the order is significant, we should keep it as List.
>
> On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <mi...@magine.com>> wrote:
> If you want it more generic, it should be Iterable rather than Iterator.
>
> On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <<m...@gmail.com>> wrote:
> You Can still achieve enhanced for loop using iterator by using following modification.
>
> I apologize if this thread going in different context. We can go with either List or Set depending on the Requirement.
>
> Code Snippet:
>
> import java.util.HashSet;
> import java.util.Iterator;
> import java.util.Set;
>
> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>
> static class Plugin {
> String name;
> Plugin(String name) {
> this.name<http://this.name> = name;
> }
> public String toString() {
> return "Plugin{" + name + "}";
> }
> }
>
> Set<Plugin> set = new HashSet<Plugin>();
>
> public void addPenguin(Plugin p) {
> set.add(p);
> }
>
> public Iterator<Plugin> getPlugins() {
> return set.iterator();
> }
>
> public Iterator<Plugin> iterator() {
> return getPlugins();
> }
>
> public static void main(String args[]) {
> PluginIterator pluginIterators = new PluginIterator();
> Plugin plugin1 = new Plugin("Plugin-1");
> Plugin plugin2 = new Plugin("Plugin-2");
> Plugin plugin3 = new Plugin("Plugin-3");
> Plugin plugin4 = new Plugin("Plugin-4");
> pluginIterators.addPenguin(plugin1);
> pluginIterators.addPenguin(plugin2);
> pluginIterators.addPenguin(plugin3);
> pluginIterators.addPenguin(plugin4);
> for (Plugin p : pluginIterators) {
> System.out.println(p);
> }
> }
> }
>
> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <<m...@gmail.com>> wrote:
> I dislike this iterator business very much, and you can't use it in a for each loop.
>
> Gary
>
> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <<m...@gmail.com>> wrote:
> How about this, Unmodifiable Iterator
>
> Iterator<String> getPluginPackages();
>
> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <<m...@gmail.com>> wrote:
> List<String> getPluginPackages();
>
> G
>
> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <<m...@apache.org>> wrote:
>
> Thu can only use Set if you have a notion of equality and comparison. Do you for this collection?
>
> On Jan 11, 2016 9:48 PM, "Gary Gregory" <<m...@gmail.com>> wrote:
> Well, not really, I'd like to express whether the collection allows for duplicates or not, if not, use a set.
>
> Gary
>
> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <<m...@gmail.com>> wrote:
> Even a Collection works well for this.
>
>
> On Monday, 11 January 2016, Gary Gregory <<m...@gmail.com>> wrote:
> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ra...@dslextreme.com>> wrote:
> It is returning a List already. Does it really matter much?
>
> It is not indeed critical. It's just a finer point of declaring the intention of the data model, either duplicates are allowed and expected, or not.
>
> Gary
>
> Ralph
>
> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>> wrote:
>
> Should APIs like:
>
> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>
> really return a List instead of a Set?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com<ma...@gmail.com> | ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
> Home: <http://garygregory.com/> http://garygregory.com/
> Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>
>
>
>
> --
> E-Mail: garydgregory@gmail.com<ma...@gmail.com> | ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
> Home: <http://garygregory.com/> http://garygregory.com/
> Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>
>
> --
> Matt Sicker <<m...@gmail.com>>
>
>
>
> --
> E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
> Home: <http://garygregory.com/> http://garygregory.com/
> Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>
>
>
> --
> E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
> Home: <http://garygregory.com/> http://garygregory.com/
> Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>
>
>
> --
> Regards,
> Sampath
>
>
>
> --
> E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
> Home: <http://garygregory.com/> http://garygregory.com/
> Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
>
>
>
> --
> Regards,
> Sampath
>
>
>
> --
>
>
> Mikael Ståldal
> Senior software developer
>
> Magine TV
> <ma...@magine.com>
> Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/> www.magine.com<http://www.magine.com>
>
> Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply email.
>
>
>
> --
>
>
> Mikael Ståldal
> Senior software developer
>
> Magine TV
> <ma...@magine.com>
> Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/> www.magine.com<http://www.magine.com>
>
> Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply email.
>
>
>
> --
> E-Mail: garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
> Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
> Spring Batch in Action<http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com<http://garygregory.wordpress.com/>
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>
> --
> Matt Sicker <<m...@gmail.com>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: List vs. Set
Posted by "Swor, Steve" <St...@team.telstra.com>.
My thoughts based on the conversation so far:
1. How important is it to expose the duplicates/ordering semantics in the public API? My preference is to keep it as loose/flexible as possible (e.g. use Collection unless there is a specific reason to narrow it further in the public API).
As far as choosing the implementation, I've come up with a brief decision tree which should (hopefully) help.
Must prevent duplicates?
No:
......Must be thread-safe?
......Yes: use CopyOnWriteArrayList
......No: use ArrayList
Yes:
......Must be thread-safe?
......No:
............Must be ordered?
............No: use HashSet
............Yes:
..................Must preserve the order in which objects were added?
..................No: use TreeSet
..................Yes: use LinkedHashSet
....Yes:
...........Must be ordered?
...........No: use ConcurrentHashSet
...........Yes:
.................Must preserve the order in which objects were added?
.................No: use ConcurrentSkipListSet
.................Yes: use CopyOnWriteArraySet
Cheers,
Steve
On 13/01/16 07:03, Matt Sicker wrote:
What about NavigableSet? ;)
On 12 January 2016 at 13:57, Gary Gregory <ga...@gmail.com>> wrote:
For completeness' sake: A set can also be ordered: https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
Gary
On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <<m...@magine.com>> wrote:
List is a Collection with the additional semantics of being ordered. Set is a Collection with the additional semantics of having no duplicates.
So is the order of the plugins significant? If not it should be Collection or Iterable (or possibly Set) rather than List. If the order is significant, we should keep it as List.
On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <mi...@magine.com>> wrote:
If you want it more generic, it should be Iterable rather than Iterator.
On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <<m...@gmail.com>> wrote:
You Can still achieve enhanced for loop using iterator by using following modification.
I apologize if this thread going in different context. We can go with either List or Set depending on the Requirement.
Code Snippet:
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class PluginIterator implements Iterable<PluginIterator.Plugin> {
static class Plugin {
String name;
Plugin(String name) {
this.name<http://this.name> = name;
}
public String toString() {
return "Plugin{" + name + "}";
}
}
Set<Plugin> set = new HashSet<Plugin>();
public void addPenguin(Plugin p) {
set.add(p);
}
public Iterator<Plugin> getPlugins() {
return set.iterator();
}
public Iterator<Plugin> iterator() {
return getPlugins();
}
public static void main(String args[]) {
PluginIterator pluginIterators = new PluginIterator();
Plugin plugin1 = new Plugin("Plugin-1");
Plugin plugin2 = new Plugin("Plugin-2");
Plugin plugin3 = new Plugin("Plugin-3");
Plugin plugin4 = new Plugin("Plugin-4");
pluginIterators.addPenguin(plugin1);
pluginIterators.addPenguin(plugin2);
pluginIterators.addPenguin(plugin3);
pluginIterators.addPenguin(plugin4);
for (Plugin p : pluginIterators) {
System.out.println(p);
}
}
}
On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <<m...@gmail.com>> wrote:
I dislike this iterator business very much, and you can't use it in a for each loop.
Gary
On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <<m...@gmail.com>> wrote:
How about this, Unmodifiable Iterator
Iterator<String> getPluginPackages();
On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <<m...@gmail.com>> wrote:
List<String> getPluginPackages();
G
On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <<m...@apache.org>> wrote:
Thu can only use Set if you have a notion of equality and comparison. Do you for this collection?
On Jan 11, 2016 9:48 PM, "Gary Gregory" <<m...@gmail.com>> wrote:
Well, not really, I'd like to express whether the collection allows for duplicates or not, if not, use a set.
Gary
On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <<m...@gmail.com>> wrote:
Even a Collection works well for this.
On Monday, 11 January 2016, Gary Gregory <<m...@gmail.com>> wrote:
On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ra...@dslextreme.com>> wrote:
It is returning a List already. Does it really matter much?
It is not indeed critical. It's just a finer point of declaring the intention of the data model, either duplicates are allowed and expected, or not.
Gary
Ralph
On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>> wrote:
Should APIs like:
org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
really return a List instead of a Set?
Gary
--
E-Mail: garydgregory@gmail.com<ma...@gmail.com> | ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
Home: <http://garygregory.com/> http://garygregory.com/
Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
--
E-Mail: garydgregory@gmail.com<ma...@gmail.com> | ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
Home: <http://garygregory.com/> http://garygregory.com/
Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
--
Matt Sicker <<m...@gmail.com>>
--
E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
Home: <http://garygregory.com/> http://garygregory.com/
Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
--
E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
Home: <http://garygregory.com/> http://garygregory.com/
Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
--
Regards,
Sampath
--
E-Mail: <ma...@gmail.com> garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: <http://garygregory.wordpress.com/> http://garygregory.wordpress.com
Home: <http://garygregory.com/> http://garygregory.com/
Tweet! <http://twitter.com/GaryGregory> http://twitter.com/GaryGregory
--
Regards,
Sampath
--
Mikael Ståldal
Senior software developer
Magine TV
<ma...@magine.com>
Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/> www.magine.com<http://www.magine.com>
Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply email.
--
Mikael Ståldal
Senior software developer
Magine TV
<ma...@magine.com>
Grev Turegatan 3 | 114 46 Stockholm, Sweden | <http://www.magine.com/> www.magine.com<http://www.magine.com>
Privileged and/or Confidential Information may be contained in this message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply email.
--
E-Mail: garydgregory@gmail.com<ma...@gmail.com> | <ma...@apache.org> ggregory@apache.org<ma...@apache.org>
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition<http://www.manning.com/tahchiev/>
Spring Batch in Action<http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com<http://garygregory.wordpress.com/>
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
--
Matt Sicker <<m...@gmail.com>>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: List vs. Set
Posted by Matt Sicker <bo...@gmail.com>.
What about NavigableSet? ;)
On 12 January 2016 at 13:57, Gary Gregory <ga...@gmail.com> wrote:
> For completeness' sake: A set can also be ordered:
> https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
>
> Gary
>
> On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <mikael.staldal@magine.com
> > wrote:
>
>> List is a Collection with the additional semantics of being ordered. Set
>> is a Collection with the additional semantics of having no duplicates.
>>
>> So is the order of the plugins significant? If not it should be
>> Collection or Iterable (or possibly Set) rather than List. If the order is
>> significant, we should keep it as List.
>>
>> On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <
>> mikael.staldal@magine.com> wrote:
>>
>>> If you want it more generic, it should be Iterable rather than Iterator.
>>>
>>> On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <sa...@gmail.com>
>>> wrote:
>>>
>>>> You Can still achieve enhanced for loop using iterator by using
>>>> following modification.
>>>>
>>>> I apologize if this thread going in different context. We can go with
>>>> either List or Set depending on the Requirement.
>>>>
>>>> *Code Snippet:*
>>>>
>>>> import java.util.HashSet;
>>>> import java.util.Iterator;
>>>> import java.util.Set;
>>>>
>>>> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>>>>
>>>> static class Plugin {
>>>> String name;
>>>> Plugin(String name) {
>>>> this.name = name;
>>>> }
>>>> public String toString() {
>>>> return "Plugin{" + name + "}";
>>>> }
>>>> }
>>>>
>>>> Set<Plugin> set = new HashSet<Plugin>();
>>>>
>>>> public void addPenguin(Plugin p) {
>>>> set.add(p);
>>>> }
>>>>
>>>> public Iterator<Plugin> getPlugins() {
>>>> return set.iterator();
>>>> }
>>>>
>>>> public Iterator<Plugin> iterator() {
>>>> return getPlugins();
>>>> }
>>>>
>>>> public static void main(String args[]) {
>>>> PluginIterator pluginIterators = new PluginIterator();
>>>> Plugin plugin1 = new Plugin("Plugin-1");
>>>> Plugin plugin2 = new Plugin("Plugin-2");
>>>> Plugin plugin3 = new Plugin("Plugin-3");
>>>> Plugin plugin4 = new Plugin("Plugin-4");
>>>> pluginIterators.addPenguin(plugin1);
>>>> pluginIterators.addPenguin(plugin2);
>>>> pluginIterators.addPenguin(plugin3);
>>>> pluginIterators.addPenguin(plugin4);
>>>> for (Plugin p : pluginIterators) {
>>>> System.out.println(p);
>>>> }
>>>> }
>>>> }
>>>>
>>>> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
>>>> wrote:
>>>>
>>>>> I dislike this iterator business very much, and you can't use it in a
>>>>> for each loop.
>>>>>
>>>>> Gary
>>>>>
>>>>> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> How about this, Unmodifiable Iterator
>>>>>>
>>>>>> Iterator<String> getPluginPackages();
>>>>>>
>>>>>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <garydgregory@gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> List<String> getPluginPackages();
>>>>>>>
>>>>>>> G
>>>>>>>
>>>>>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pbenedict@apache.org
>>>>>>> > wrote:
>>>>>>>
>>>>>>>> Thu can only use Set if you have a notion of equality and
>>>>>>>> comparison. Do you for this collection?
>>>>>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Well, not really, I'd like to express whether the collection
>>>>>>>>> allows for duplicates or not, if not, use a set.
>>>>>>>>>
>>>>>>>>> Gary
>>>>>>>>>
>>>>>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Even a Collection works well for this.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> It is not indeed critical. It's just a finer point of declaring
>>>>>>>>>>> the intention of the data model, either duplicates are allowed and
>>>>>>>>>>> expected, or not.
>>>>>>>>>>>
>>>>>>>>>>> Gary
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Ralph
>>>>>>>>>>>>
>>>>>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <
>>>>>>>>>>>> garydgregory@gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> Should APIs like:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>>>>>
>>>>>>>>>>>> really return a List instead of a Set?
>>>>>>>>>>>>
>>>>>>>>>>>> Gary
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Sampath
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Sampath
>>>>
>>>
>>>
>>>
>>> --
>>> [image: MagineTV]
>>>
>>> *Mikael Ståldal*
>>> Senior software developer
>>>
>>> *Magine TV*
>>> mikael.staldal@magine.com
>>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>>>
>>> Privileged and/or Confidential Information may be contained in this
>>> message. If you are not the addressee indicated in this message
>>> (or responsible for delivery of the message to such a person), you may
>>> not copy or deliver this message to anyone. In such case,
>>> you should destroy this message and kindly notify the sender by reply
>>> email.
>>>
>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
Matt Sicker <bo...@gmail.com>
Re: List vs. Set
Posted by Gary Gregory <ga...@gmail.com>.
For completeness' sake: A set can also be ordered:
https://docs.oracle.com/javase/8/docs/api/java/util/SortedSet.html
Gary
On Tue, Jan 12, 2016 at 4:09 AM, Mikael Ståldal <mi...@magine.com>
wrote:
> List is a Collection with the additional semantics of being ordered. Set
> is a Collection with the additional semantics of having no duplicates.
>
> So is the order of the plugins significant? If not it should be Collection
> or Iterable (or possibly Set) rather than List. If the order is
> significant, we should keep it as List.
>
> On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <
> mikael.staldal@magine.com> wrote:
>
>> If you want it more generic, it should be Iterable rather than Iterator.
>>
>> On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <sa...@gmail.com>
>> wrote:
>>
>>> You Can still achieve enhanced for loop using iterator by using
>>> following modification.
>>>
>>> I apologize if this thread going in different context. We can go with
>>> either List or Set depending on the Requirement.
>>>
>>> *Code Snippet:*
>>>
>>> import java.util.HashSet;
>>> import java.util.Iterator;
>>> import java.util.Set;
>>>
>>> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>>>
>>> static class Plugin {
>>> String name;
>>> Plugin(String name) {
>>> this.name = name;
>>> }
>>> public String toString() {
>>> return "Plugin{" + name + "}";
>>> }
>>> }
>>>
>>> Set<Plugin> set = new HashSet<Plugin>();
>>>
>>> public void addPenguin(Plugin p) {
>>> set.add(p);
>>> }
>>>
>>> public Iterator<Plugin> getPlugins() {
>>> return set.iterator();
>>> }
>>>
>>> public Iterator<Plugin> iterator() {
>>> return getPlugins();
>>> }
>>>
>>> public static void main(String args[]) {
>>> PluginIterator pluginIterators = new PluginIterator();
>>> Plugin plugin1 = new Plugin("Plugin-1");
>>> Plugin plugin2 = new Plugin("Plugin-2");
>>> Plugin plugin3 = new Plugin("Plugin-3");
>>> Plugin plugin4 = new Plugin("Plugin-4");
>>> pluginIterators.addPenguin(plugin1);
>>> pluginIterators.addPenguin(plugin2);
>>> pluginIterators.addPenguin(plugin3);
>>> pluginIterators.addPenguin(plugin4);
>>> for (Plugin p : pluginIterators) {
>>> System.out.println(p);
>>> }
>>> }
>>> }
>>>
>>> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>
>>>> I dislike this iterator business very much, and you can't use it in a
>>>> for each loop.
>>>>
>>>> Gary
>>>>
>>>> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
>>>> wrote:
>>>>
>>>>> How about this, Unmodifiable Iterator
>>>>>
>>>>> Iterator<String> getPluginPackages();
>>>>>
>>>>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> List<String> getPluginPackages();
>>>>>>
>>>>>> G
>>>>>>
>>>>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> Thu can only use Set if you have a notion of equality and
>>>>>>> comparison. Do you for this collection?
>>>>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Well, not really, I'd like to express whether the collection allows
>>>>>>>> for duplicates or not, if not, use a set.
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Even a Collection works well for this.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It is not indeed critical. It's just a finer point of declaring
>>>>>>>>>> the intention of the data model, either duplicates are allowed and
>>>>>>>>>> expected, or not.
>>>>>>>>>>
>>>>>>>>>> Gary
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Ralph
>>>>>>>>>>>
>>>>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <
>>>>>>>>>>> garydgregory@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Should APIs like:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>>>>
>>>>>>>>>>> really return a List instead of a Set?
>>>>>>>>>>>
>>>>>>>>>>> Gary
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Sampath
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Sampath
>>>
>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by Matt Sicker <bo...@gmail.com>.
Definitely prefer Iterable over Iterator.
On 12 January 2016 at 06:09, Mikael Ståldal <mi...@magine.com>
wrote:
> List is a Collection with the additional semantics of being ordered. Set
> is a Collection with the additional semantics of having no duplicates.
>
> So is the order of the plugins significant? If not it should be Collection
> or Iterable (or possibly Set) rather than List. If the order is
> significant, we should keep it as List.
>
> On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <
> mikael.staldal@magine.com> wrote:
>
>> If you want it more generic, it should be Iterable rather than Iterator.
>>
>> On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <sa...@gmail.com>
>> wrote:
>>
>>> You Can still achieve enhanced for loop using iterator by using
>>> following modification.
>>>
>>> I apologize if this thread going in different context. We can go with
>>> either List or Set depending on the Requirement.
>>>
>>> *Code Snippet:*
>>>
>>> import java.util.HashSet;
>>> import java.util.Iterator;
>>> import java.util.Set;
>>>
>>> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>>>
>>> static class Plugin {
>>> String name;
>>> Plugin(String name) {
>>> this.name = name;
>>> }
>>> public String toString() {
>>> return "Plugin{" + name + "}";
>>> }
>>> }
>>>
>>> Set<Plugin> set = new HashSet<Plugin>();
>>>
>>> public void addPenguin(Plugin p) {
>>> set.add(p);
>>> }
>>>
>>> public Iterator<Plugin> getPlugins() {
>>> return set.iterator();
>>> }
>>>
>>> public Iterator<Plugin> iterator() {
>>> return getPlugins();
>>> }
>>>
>>> public static void main(String args[]) {
>>> PluginIterator pluginIterators = new PluginIterator();
>>> Plugin plugin1 = new Plugin("Plugin-1");
>>> Plugin plugin2 = new Plugin("Plugin-2");
>>> Plugin plugin3 = new Plugin("Plugin-3");
>>> Plugin plugin4 = new Plugin("Plugin-4");
>>> pluginIterators.addPenguin(plugin1);
>>> pluginIterators.addPenguin(plugin2);
>>> pluginIterators.addPenguin(plugin3);
>>> pluginIterators.addPenguin(plugin4);
>>> for (Plugin p : pluginIterators) {
>>> System.out.println(p);
>>> }
>>> }
>>> }
>>>
>>> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>
>>>> I dislike this iterator business very much, and you can't use it in a
>>>> for each loop.
>>>>
>>>> Gary
>>>>
>>>> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
>>>> wrote:
>>>>
>>>>> How about this, Unmodifiable Iterator
>>>>>
>>>>> Iterator<String> getPluginPackages();
>>>>>
>>>>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> List<String> getPluginPackages();
>>>>>>
>>>>>> G
>>>>>>
>>>>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>>>>>> wrote:
>>>>>>
>>>>>>> Thu can only use Set if you have a notion of equality and
>>>>>>> comparison. Do you for this collection?
>>>>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Well, not really, I'd like to express whether the collection allows
>>>>>>>> for duplicates or not, if not, use a set.
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Even a Collection works well for this.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> It is not indeed critical. It's just a finer point of declaring
>>>>>>>>>> the intention of the data model, either duplicates are allowed and
>>>>>>>>>> expected, or not.
>>>>>>>>>>
>>>>>>>>>> Gary
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Ralph
>>>>>>>>>>>
>>>>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <
>>>>>>>>>>> garydgregory@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>> Should APIs like:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>>>>
>>>>>>>>>>> really return a List instead of a Set?
>>>>>>>>>>>
>>>>>>>>>>> Gary
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Sampath
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Sampath
>>>
>>
>>
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
--
Matt Sicker <bo...@gmail.com>
Re: List vs. Set
Posted by Mikael Ståldal <mi...@magine.com>.
List is a Collection with the additional semantics of being ordered. Set is
a Collection with the additional semantics of having no duplicates.
So is the order of the plugins significant? If not it should be Collection
or Iterable (or possibly Set) rather than List. If the order is
significant, we should keep it as List.
On Tue, Jan 12, 2016 at 12:59 PM, Mikael Ståldal <mi...@magine.com>
wrote:
> If you want it more generic, it should be Iterable rather than Iterator.
>
> On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <sa...@gmail.com>
> wrote:
>
>> You Can still achieve enhanced for loop using iterator by using following
>> modification.
>>
>> I apologize if this thread going in different context. We can go with
>> either List or Set depending on the Requirement.
>>
>> *Code Snippet:*
>>
>> import java.util.HashSet;
>> import java.util.Iterator;
>> import java.util.Set;
>>
>> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>>
>> static class Plugin {
>> String name;
>> Plugin(String name) {
>> this.name = name;
>> }
>> public String toString() {
>> return "Plugin{" + name + "}";
>> }
>> }
>>
>> Set<Plugin> set = new HashSet<Plugin>();
>>
>> public void addPenguin(Plugin p) {
>> set.add(p);
>> }
>>
>> public Iterator<Plugin> getPlugins() {
>> return set.iterator();
>> }
>>
>> public Iterator<Plugin> iterator() {
>> return getPlugins();
>> }
>>
>> public static void main(String args[]) {
>> PluginIterator pluginIterators = new PluginIterator();
>> Plugin plugin1 = new Plugin("Plugin-1");
>> Plugin plugin2 = new Plugin("Plugin-2");
>> Plugin plugin3 = new Plugin("Plugin-3");
>> Plugin plugin4 = new Plugin("Plugin-4");
>> pluginIterators.addPenguin(plugin1);
>> pluginIterators.addPenguin(plugin2);
>> pluginIterators.addPenguin(plugin3);
>> pluginIterators.addPenguin(plugin4);
>> for (Plugin p : pluginIterators) {
>> System.out.println(p);
>> }
>> }
>> }
>>
>> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>
>>> I dislike this iterator business very much, and you can't use it in a
>>> for each loop.
>>>
>>> Gary
>>>
>>> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
>>> wrote:
>>>
>>>> How about this, Unmodifiable Iterator
>>>>
>>>> Iterator<String> getPluginPackages();
>>>>
>>>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
>>>> wrote:
>>>>
>>>>> List<String> getPluginPackages();
>>>>>
>>>>> G
>>>>>
>>>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>>>>> wrote:
>>>>>
>>>>>> Thu can only use Set if you have a notion of equality and comparison.
>>>>>> Do you for this collection?
>>>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Well, not really, I'd like to express whether the collection allows
>>>>>>> for duplicates or not, if not, use a set.
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Even a Collection works well for this.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>>>
>>>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> It is not indeed critical. It's just a finer point of declaring
>>>>>>>>> the intention of the data model, either duplicates are allowed and
>>>>>>>>> expected, or not.
>>>>>>>>>
>>>>>>>>> Gary
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Ralph
>>>>>>>>>>
>>>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> Should APIs like:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>>>
>>>>>>>>>> really return a List instead of a Set?
>>>>>>>>>>
>>>>>>>>>> Gary
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>>> JUnit in Action, Second Edition
>>>>>>>>>> <http://www.manning.com/tahchiev/>
>>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Sampath
>>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>>
>> --
>> Regards,
>> Sampath
>>
>
>
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>
--
[image: MagineTV]
*Mikael Ståldal*
Senior software developer
*Magine TV*
mikael.staldal@magine.com
Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Re: List vs. Set
Posted by Mikael Ståldal <mi...@magine.com>.
If you want it more generic, it should be Iterable rather than Iterator.
On Tue, Jan 12, 2016 at 6:34 AM, sampath kumar <sa...@gmail.com> wrote:
> You Can still achieve enhanced for loop using iterator by using following
> modification.
>
> I apologize if this thread going in different context. We can go with
> either List or Set depending on the Requirement.
>
> *Code Snippet:*
>
> import java.util.HashSet;
> import java.util.Iterator;
> import java.util.Set;
>
> public class PluginIterator implements Iterable<PluginIterator.Plugin> {
>
> static class Plugin {
> String name;
> Plugin(String name) {
> this.name = name;
> }
> public String toString() {
> return "Plugin{" + name + "}";
> }
> }
>
> Set<Plugin> set = new HashSet<Plugin>();
>
> public void addPenguin(Plugin p) {
> set.add(p);
> }
>
> public Iterator<Plugin> getPlugins() {
> return set.iterator();
> }
>
> public Iterator<Plugin> iterator() {
> return getPlugins();
> }
>
> public static void main(String args[]) {
> PluginIterator pluginIterators = new PluginIterator();
> Plugin plugin1 = new Plugin("Plugin-1");
> Plugin plugin2 = new Plugin("Plugin-2");
> Plugin plugin3 = new Plugin("Plugin-3");
> Plugin plugin4 = new Plugin("Plugin-4");
> pluginIterators.addPenguin(plugin1);
> pluginIterators.addPenguin(plugin2);
> pluginIterators.addPenguin(plugin3);
> pluginIterators.addPenguin(plugin4);
> for (Plugin p : pluginIterators) {
> System.out.println(p);
> }
> }
> }
>
> On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> I dislike this iterator business very much, and you can't use it in a for
>> each loop.
>>
>> Gary
>>
>> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
>> wrote:
>>
>>> How about this, Unmodifiable Iterator
>>>
>>> Iterator<String> getPluginPackages();
>>>
>>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>
>>>> List<String> getPluginPackages();
>>>>
>>>> G
>>>>
>>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>>>> wrote:
>>>>
>>>>> Thu can only use Set if you have a notion of equality and comparison.
>>>>> Do you for this collection?
>>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Well, not really, I'd like to express whether the collection allows
>>>>>> for duplicates or not, if not, use a set.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Even a Collection works well for this.
>>>>>>>
>>>>>>>
>>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>>
>>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>>
>>>>>>>>
>>>>>>>> It is not indeed critical. It's just a finer point of declaring the
>>>>>>>> intention of the data model, either duplicates are allowed and expected, or
>>>>>>>> not.
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Ralph
>>>>>>>>>
>>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> Should APIs like:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>>
>>>>>>>>> really return a List instead of a Set?
>>>>>>>>>
>>>>>>>>> Gary
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>>> Home: http://garygregory.com/
>>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>>
>>> --
>>> Regards,
>>> Sampath
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Regards,
> Sampath
>
--
[image: MagineTV]
*Mikael Ståldal*
Senior software developer
*Magine TV*
mikael.staldal@magine.com
Grev Turegatan 3 | 114 46 Stockholm, Sweden | www.magine.com
Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.
Re: List vs. Set
Posted by sampath kumar <sa...@gmail.com>.
You Can still achieve enhanced for loop using iterator by using following
modification.
I apologize if this thread going in different context. We can go with
either List or Set depending on the Requirement.
*Code Snippet:*
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class PluginIterator implements Iterable<PluginIterator.Plugin> {
static class Plugin {
String name;
Plugin(String name) {
this.name = name;
}
public String toString() {
return "Plugin{" + name + "}";
}
}
Set<Plugin> set = new HashSet<Plugin>();
public void addPenguin(Plugin p) {
set.add(p);
}
public Iterator<Plugin> getPlugins() {
return set.iterator();
}
public Iterator<Plugin> iterator() {
return getPlugins();
}
public static void main(String args[]) {
PluginIterator pluginIterators = new PluginIterator();
Plugin plugin1 = new Plugin("Plugin-1");
Plugin plugin2 = new Plugin("Plugin-2");
Plugin plugin3 = new Plugin("Plugin-3");
Plugin plugin4 = new Plugin("Plugin-4");
pluginIterators.addPenguin(plugin1);
pluginIterators.addPenguin(plugin2);
pluginIterators.addPenguin(plugin3);
pluginIterators.addPenguin(plugin4);
for (Plugin p : pluginIterators) {
System.out.println(p);
}
}
}
On Tue, Jan 12, 2016 at 10:24 AM, Gary Gregory <ga...@gmail.com>
wrote:
> I dislike this iterator business very much, and you can't use it in a for
> each loop.
>
> Gary
>
> On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com>
> wrote:
>
>> How about this, Unmodifiable Iterator
>>
>> Iterator<String> getPluginPackages();
>>
>> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
>> wrote:
>>
>>> List<String> getPluginPackages();
>>>
>>> G
>>>
>>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>>> wrote:
>>>
>>>> Thu can only use Set if you have a notion of equality and comparison.
>>>> Do you for this collection?
>>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
>>>>
>>>>> Well, not really, I'd like to express whether the collection allows
>>>>> for duplicates or not, if not, use a set.
>>>>>
>>>>> Gary
>>>>>
>>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>>
>>>>>> Even a Collection works well for this.
>>>>>>
>>>>>>
>>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>
>>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>>
>>>>>>>
>>>>>>> It is not indeed critical. It's just a finer point of declaring the
>>>>>>> intention of the data model, either duplicates are allowed and expected, or
>>>>>>> not.
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>>>
>>>>>>>> Ralph
>>>>>>>>
>>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>> Should APIs like:
>>>>>>>>
>>>>>>>>
>>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>>
>>>>>>>> really return a List instead of a Set?
>>>>>>>>
>>>>>>>> Gary
>>>>>>>>
>>>>>>>> --
>>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>>> Home: http://garygregory.com/
>>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Matt Sicker <bo...@gmail.com>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>>
>> --
>> Regards,
>> Sampath
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
Regards,
Sampath
Re: List vs. Set
Posted by Gary Gregory <ga...@gmail.com>.
I dislike this iterator business very much, and you can't use it in a for
each loop.
Gary
On Mon, Jan 11, 2016 at 8:46 PM, sampath kumar <sa...@gmail.com> wrote:
> How about this, Unmodifiable Iterator
>
> Iterator<String> getPluginPackages();
>
> On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
> wrote:
>
>> List<String> getPluginPackages();
>>
>> G
>>
>> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
>> wrote:
>>
>>> Thu can only use Set if you have a notion of equality and comparison. Do
>>> you for this collection?
>>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
>>>
>>>> Well, not really, I'd like to express whether the collection allows for
>>>> duplicates or not, if not, use a set.
>>>>
>>>> Gary
>>>>
>>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>>
>>>>> Even a Collection works well for this.
>>>>>
>>>>>
>>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>
>>>>>>> It is returning a List already. Does it really matter much?
>>>>>>>
>>>>>>
>>>>>> It is not indeed critical. It's just a finer point of declaring the
>>>>>> intention of the data model, either duplicates are allowed and expected, or
>>>>>> not.
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>>>
>>>>>>> Ralph
>>>>>>>
>>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Should APIs like:
>>>>>>>
>>>>>>>
>>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>>
>>>>>>> really return a List instead of a Set?
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>> --
>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <bo...@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
>
> --
> Regards,
> Sampath
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by sampath kumar <sa...@gmail.com>.
How about this, Unmodifiable Iterator
Iterator<String> getPluginPackages();
On Tue, Jan 12, 2016 at 9:50 AM, Gary Gregory <ga...@gmail.com>
wrote:
> List<String> getPluginPackages();
>
> G
>
> On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org>
> wrote:
>
>> Thu can only use Set if you have a notion of equality and comparison. Do
>> you for this collection?
>> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
>>
>>> Well, not really, I'd like to express whether the collection allows for
>>> duplicates or not, if not, use a set.
>>>
>>> Gary
>>>
>>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>>>
>>>> Even a Collection works well for this.
>>>>
>>>>
>>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com>
>>>> wrote:
>>>>
>>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>
>>>>>> It is returning a List already. Does it really matter much?
>>>>>>
>>>>>
>>>>> It is not indeed critical. It's just a finer point of declaring the
>>>>> intention of the data model, either duplicates are allowed and expected, or
>>>>> not.
>>>>>
>>>>> Gary
>>>>>
>>>>>>
>>>>>> Ralph
>>>>>>
>>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Should APIs like:
>>>>>>
>>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>>
>>>>>> really return a List instead of a Set?
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <bo...@gmail.com>
>>>>
>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
Regards,
Sampath
Re: List vs. Set
Posted by Gary Gregory <ga...@gmail.com>.
List<String> getPluginPackages();
G
On Mon, Jan 11, 2016 at 8:12 PM, Paul Benedict <pb...@apache.org> wrote:
> Thu can only use Set if you have a notion of equality and comparison. Do
> you for this collection?
> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
>
>> Well, not really, I'd like to express whether the collection allows for
>> duplicates or not, if not, use a set.
>>
>> Gary
>>
>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> Even a Collection works well for this.
>>>
>>>
>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>> ralph.goers@dslextreme.com> wrote:
>>>>
>>>>> It is returning a List already. Does it really matter much?
>>>>>
>>>>
>>>> It is not indeed critical. It's just a finer point of declaring the
>>>> intention of the data model, either duplicates are allowed and expected, or
>>>> not.
>>>>
>>>> Gary
>>>>
>>>>>
>>>>> Ralph
>>>>>
>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Should APIs like:
>>>>>
>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>
>>>>> really return a List instead of a Set?
>>>>>
>>>>> Gary
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by sampath kumar <sa...@gmail.com>.
I think this API used for only Read only, i feel it should follow iterator
pattern, correct me if I am wrong here ?
On Tue, Jan 12, 2016 at 9:42 AM, Paul Benedict <pb...@apache.org> wrote:
> Thu can only use Set if you have a notion of equality and comparison. Do
> you for this collection?
> On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
>
>> Well, not really, I'd like to express whether the collection allows for
>> duplicates or not, if not, use a set.
>>
>> Gary
>>
>> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>>
>>> Even a Collection works well for this.
>>>
>>>
>>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com> wrote:
>>>
>>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <
>>>> ralph.goers@dslextreme.com> wrote:
>>>>
>>>>> It is returning a List already. Does it really matter much?
>>>>>
>>>>
>>>> It is not indeed critical. It's just a finer point of declaring the
>>>> intention of the data model, either duplicates are allowed and expected, or
>>>> not.
>>>>
>>>> Gary
>>>>
>>>>>
>>>>> Ralph
>>>>>
>>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>>> wrote:
>>>>>
>>>>> Should APIs like:
>>>>>
>>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>>
>>>>> really return a List instead of a Set?
>>>>>
>>>>> Gary
>>>>>
>>>>> --
>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>> Java Persistence with Hibernate, Second Edition
>>>>> <http://www.manning.com/bauer3/>
>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>> Blog: http://garygregory.wordpress.com
>>>>> Home: http://garygregory.com/
>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>
>>>
>>> --
>>> Matt Sicker <bo...@gmail.com>
>>>
>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
--
Regards,
Sampath
Re: List vs. Set
Posted by Paul Benedict <pb...@apache.org>.
Thu can only use Set if you have a notion of equality and comparison. Do
you for this collection?
On Jan 11, 2016 9:48 PM, "Gary Gregory" <ga...@gmail.com> wrote:
> Well, not really, I'd like to express whether the collection allows for
> duplicates or not, if not, use a set.
>
> Gary
>
> On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
>
>> Even a Collection works well for this.
>>
>>
>> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com> wrote:
>>
>>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ralph.goers@dslextreme.com
>>> > wrote:
>>>
>>>> It is returning a List already. Does it really matter much?
>>>>
>>>
>>> It is not indeed critical. It's just a finer point of declaring the
>>> intention of the data model, either duplicates are allowed and expected, or
>>> not.
>>>
>>> Gary
>>>
>>>>
>>>> Ralph
>>>>
>>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>>> wrote:
>>>>
>>>> Should APIs like:
>>>>
>>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>>
>>>> really return a List instead of a Set?
>>>>
>>>> Gary
>>>>
>>>> --
>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>> Java Persistence with Hibernate, Second Edition
>>>> <http://www.manning.com/bauer3/>
>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>> Blog: http://garygregory.wordpress.com
>>>> Home: http://garygregory.com/
>>>> Tweet! http://twitter.com/GaryGregory
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>
>>
>> --
>> Matt Sicker <bo...@gmail.com>
>>
>
>
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
Re: List vs. Set
Posted by Gary Gregory <ga...@gmail.com>.
Well, not really, I'd like to express whether the collection allows for
duplicates or not, if not, use a set.
Gary
On Mon, Jan 11, 2016 at 7:08 PM, Matt Sicker <bo...@gmail.com> wrote:
> Even a Collection works well for this.
>
>
> On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com> wrote:
>
>> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ra...@dslextreme.com>
>> wrote:
>>
>>> It is returning a List already. Does it really matter much?
>>>
>>
>> It is not indeed critical. It's just a finer point of declaring the
>> intention of the data model, either duplicates are allowed and expected, or
>> not.
>>
>> Gary
>>
>>>
>>> Ralph
>>>
>>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com>
>>> wrote:
>>>
>>> Should APIs like:
>>>
>>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>>
>>> really return a List instead of a Set?
>>>
>>> Gary
>>>
>>> --
>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>>
>>>
>>>
>>
>>
>> --
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by Matt Sicker <bo...@gmail.com>.
Even a Collection works well for this.
On Monday, 11 January 2016, Gary Gregory <ga...@gmail.com> wrote:
> On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ralph.goers@dslextreme.com
> <javascript:_e(%7B%7D,'cvml','ralph.goers@dslextreme.com');>> wrote:
>
>> It is returning a List already. Does it really matter much?
>>
>
> It is not indeed critical. It's just a finer point of declaring the
> intention of the data model, either duplicates are allowed and expected, or
> not.
>
> Gary
>
>>
>> Ralph
>>
>> On Jan 11, 2016, at 6:04 PM, Gary Gregory <garydgregory@gmail.com
>> <javascript:_e(%7B%7D,'cvml','garydgregory@gmail.com');>> wrote:
>>
>> Should APIs like:
>>
>> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>>
>> really return a List instead of a Set?
>>
>> Gary
>>
>> --
>> E-Mail: garydgregory@gmail.com
>> <javascript:_e(%7B%7D,'cvml','garydgregory@gmail.com');> | ggregory@apache.org
>> <javascript:_e(%7B%7D,'cvml','ggregory@apache.org');>
>> Java Persistence with Hibernate, Second Edition
>> <http://www.manning.com/bauer3/>
>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>> Spring Batch in Action <http://www.manning.com/templier/>
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>>
>>
>
>
> --
> E-Mail: garydgregory@gmail.com
> <javascript:_e(%7B%7D,'cvml','garydgregory@gmail.com');> | ggregory@apache.org
> <javascript:_e(%7B%7D,'cvml','ggregory@apache.org');>
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
--
Matt Sicker <bo...@gmail.com>
Re: List vs. Set
Posted by Gary Gregory <ga...@gmail.com>.
On Mon, Jan 11, 2016 at 5:19 PM, Ralph Goers <ra...@dslextreme.com>
wrote:
> It is returning a List already. Does it really matter much?
>
It is not indeed critical. It's just a finer point of declaring the
intention of the data model, either duplicates are allowed and expected, or
not.
Gary
>
> Ralph
>
> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com> wrote:
>
> Should APIs like:
>
> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>
> really return a List instead of a Set?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com | ggregory@apache.org
> Java Persistence with Hibernate, Second Edition
> <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
>
>
--
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory
Re: List vs. Set
Posted by Ralph Goers <ra...@dslextreme.com>.
It is returning a List already. Does it really matter much?
Ralph
> On Jan 11, 2016, at 6:04 PM, Gary Gregory <ga...@gmail.com> wrote:
>
> Should APIs like:
>
> org.apache.logging.log4j.core.config.Configuration.getPluginPackages()
>
> really return a List instead of a Set?
>
> Gary
>
> --
> E-Mail: garydgregory@gmail.com <ma...@gmail.com> | ggregory@apache.org <ma...@apache.org>
> Java Persistence with Hibernate, Second Edition <http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/>
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>