I want to get new Object[] for example. I think if idea makes
new Object[], then pressing ]]> same result will be done. By this way, users who create arrays in a single line will be glad too. (for example for code like:
ArrayList alFoos = new ArrayList(); . . . Foo[] foos = alFoos.toArray(new Foo[]{}); return foos; ) closing '{' will be very helpfull in my opnion.
I want to get new Object[] for example. I think if idea makes
>
new Object[], then pressing <enter> same result will be done. By this way, users who create arrays in a single line will be glad too. (for example for code like:
>
ArrayList alFoos = new ArrayList(); . . . Foo[] foos = alFoos.toArray(new Foo[]{}); return foos; ) closing '{' will be very helpfull in my opnion.
I want to get new Object[] for example. I think if idea makes
>
new Object[], then pressing <enter> same result will be done. By this way, users who create arrays in a single line will be glad too. (for example for code like:
ee, this example doesn't seem too useful, if you want to return a empty array just delete both lines and IDEA will show you the "Add Return Statement" intention that will generate: return new Foo[0];
If what you want to return is alFoos as a list then delete both lines and write return toar and hit the expand live templates key, you will get: return (Foo[]) alFoos.toArray(new Foo[alFoos.size()]);
Also there are some cases where we need to send to an array to a method. For example:
Class A{ ... }
Class Dummy { public Object[]proceedAs(A[] as){ ... } }
. . . A a1 = new A(...); A a2 = new A(...); Dummy d = new Dummy(); Object[] results = d.proceedAs(new A[]{a1,a2}); . . .
Also if '{' is closed by default with '}', still gives the same result with pressing after '{' when it is not closed automatically. One of the points I love Idea is it is coded to help programmer to make minimum keystrokes. For example for new created methods, IDEA shows it's intelligence to make method like:
.
.
.
private automaticCreatedMethod(someParameters) {#
####################################################
}
.
.
.
Here '#' means selected line. By this way if user press enter the he will have:
.
.
.
private automaticCreatedMethod(someParameters){
}
.
.
.
Also if he write another key, he will have
.
.
.
private automaticCreatedMethod(someParameters) { i]]>} . . . which is a one line method especially usefull for very short methods.
There are always cases where a structure like "XXX[]{..}". So I think it should be closed automatically.
PS: 'toar' live template works only for collections. It does not work for arraylists. For programmers who use arraylists, I attached a live template named "conar" which makes same job with "toar".
Also there are some cases where we need to send to an array to a method. For example:
>
Class A{ ... }
>
Class Dummy { public Object[]proceedAs(A[] as){ ... } }
>
. . . A a1 = new A(...); A a2 = new A(...); Dummy d = new Dummy(); Object[] results = d.proceedAs(new A[]{a1,a2}); . . .
>
Also if '{' is closed by default with '}', still <enter> gives the same result with pressing <enter> after '{' when it is not closed automatically. One of the points I love Idea is it is coded to help programmer to make minimum keystrokes. For example for new created methods, IDEA shows it's intelligence to make method like: . . . private automaticCreatedMethod(someParameters) {# #################################################### } . . .
>
Here '#' means selected line. By this way if user press enter the he will have:
Also if he write another key, he will have . . . private automaticCreatedMethod(someParameters) { i<carret>} . . . which is a one line method especially usefull for very short methods.
>
There are always cases where a structure like "XXX[]{..}". So I think it should be closed automatically.
>
You are right. Fill a feature request.
PS: 'toar' live template works only for collections. It does not work for arraylists. For programmers who use arraylists, I attached a live template named "conar" which makes same job with "toar".
PS: IDEA knows that an ArrayList is a Collection, so toar works fine.
On Fri, 11 Jul 2003 14:04:26 +0000 (UTC), Gokcer Gokdal
<no_mail@jetbrains.com> wrote:
>
>
hit Enter and you get:
new Object[] {
]]>
}
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
I want to get new Object[] for example. I think if idea makes
new Object[], then pressing ]]> same result will be done. By this way, users who create arrays in a single line will be glad too. (for example for code like:
ArrayList alFoos = new ArrayList();
.
.
.
Foo[] foos = alFoos.toArray(new Foo[]{});
return foos;
)
closing '{' will be very helpfull in my opnion.
I agree, just had this today.
Gokcer Gokdal wrote:
>
>
On Tue, 15 Jul 2003 13:59:11 +0000 (UTC), Gokcer Gokdal
<no_mail@jetbrains.com> wrote:
>
>
ee, this example doesn't seem too useful, if you want to return a empty
array
just delete both lines and IDEA will show you the "Add Return Statement"
intention
that will generate:
return new Foo[0];
If what you want to return is alFoos as a list then delete both lines and
write return toar and hit the expand live templates key, you will get:
return (Foo[]) alFoos.toArray(new Foo[alFoos.size()]);
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Also there are some cases where we need to send to an array to a method. For example:
Class A{
...
}
Class Dummy {
public Object[]proceedAs(A[] as){
...
}
}
.
.
.
A a1 = new A(...);
A a2 = new A(...);
Dummy d = new Dummy();
Object[] results = d.proceedAs(new A[]{a1,a2});
.
.
.
Also if '{' is closed by default with '}', still gives the same result with pressing after '{' when it is not closed automatically. One of the points I love Idea is it is coded to help programmer to make minimum keystrokes. For example for new created methods, IDEA shows it's intelligence to make method like: . . . private automaticCreatedMethod(someParameters) {# #################################################### } . . . Here '#' means selected line. By this way if user press enter the he will have: . . . private automaticCreatedMethod(someParameters){ } . . . Also if he write another key, he will have . . . private automaticCreatedMethod(someParameters) { i]]>}
.
.
.
which is a one line method especially usefull for very short methods.
There are always cases where a structure like "XXX[]{..}". So I think it should be closed automatically.
PS: 'toar' live template works only for collections. It does not work for arraylists. For programmers who use arraylists, I attached a live template named "conar" which makes same job with "toar".
Attachment(s):
conar.xml
On Wed, 16 Jul 2003 08:37:34 +0000 (UTC), Gokcer Gokdal
<no_mail@jetbrains.com> wrote:
>
>
>
>
>
>
>
>
>
You are right. Fill a feature request.
PS: IDEA knows that an ArrayList is a Collection, so toar works fine.
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/