The ‘static import’ allows you to refer to things like this: import static java.util.Collections.sort;
public class ScratchTest { public static void main(String[] args) { java.util.List list = sort(java.util.Collections.singletonList(new Object()); } } but typically, the static import is used for constants, although for some types of routines it is used to make the code read like a DSL. > On Dec 2, 2018, at 12:04 AM, robert engels <reng...@ix.netcom.com> wrote: > > The .* doesn’t mean what you think it does - that just means all of the > classes in the package. It is no different than listing them each. > > When you use > > import java.util.Collections; > import java.util.List; > > You are actually doing a dot import, so you can in the code just refer to it > as so > > List list = Collections.singletonList(someobject) > > otherwise you need to write the code as: > > java.util.List list = java.util.Collections.singletonList(someobject); > > > > >> On Dec 1, 2018, at 11:51 PM, Ian Denhardt <i...@zenhack.net> wrote: >> >> Quoting Robert Engels (2018-12-02 00:19:40) >>> I know everyone hates it when I reference java but it has had dot >>> importsat the package level since day one. I won’t repeat why that >>> matters. It’s never been a problem. >>> >>> I don’t think I ever heard someone complain it was a problem in >>> working in Java, why is it such a problem in Go? >> >> I'll admit to not having much experience with large Java projects, so >> hard for me to say why this would be in Java. But from browsing through >> the source of a handful of open source Java projects, my first guess is: >> nobody uses them. It seems the norm is to just import each class you >> want to use individually; I don't see much .* >> >> This is why it works out in Elm -- because people don't use it much. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.