Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: What's the best way to make a cross string set? Date: Fri, 28 Jul 2017 17:20:47 -0400 Organization: A noiseless patient Spider Lines: 32 Message-ID: References: <6f9ff338-1944-4b64-83b8-4a921ce57a89@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 28 Jul 2017 21:16:48 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="d85008597f4b59fbc3d2e71ef059ed65"; logging-data="8605"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+XSt1OPqNjHk8Rm1hLXXMX" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 In-Reply-To: Content-Language: en-US Cancel-Lock: sha1:RtT0uaGsm6vn8k3UhsQxb3OuuKg= Xref: csiph.com comp.lang.java.programmer:37018 On 7/28/2017 4:28 PM, Eric Douglas wrote: > On Friday, July 28, 2017 at 3:09:01 PM UTC-4, Volker Borchert wrote: >> >> This sounds suspiciously like homework. Please do it yourself. >> > > More like work work and I did spend a few hours trying to think of more efficient ways. I did come up with other ways to arrive at the result, just trying to clean it up. You don't want to see how the original code did it.. If it's work work, you *really* should be using generics. Raw types are still supported in Java, yes -- for compatibility with existing code from more than thirteen years ago. New code, even ten-year-old code, should not be using them except in dire dire dire circumstances. So: ArrayList list1 = new ArrayList() should have been something like List> list1 = new ArrayList<>(); or List> list1 = new ArrayList<>(); or even List> list1 = new ArrayList<>(); and ArrayList list2 = new ArrayList() should have been List list2 = new ArrayList<>(); or maybe Collection list2 = new ArrayList<>(); ... and, of course, other variations are possible. -- esosman@comcast-dot-net.invalid Twelve hundred seventy-two days to go.