java - Which Way of List Initialize Is Better -


I was thinking, is the method of initializing the list better?


  Public Sector Main {Private Final List & lt; String & gt; L = New Arrestist & lt; String & gt; (); {L.add ("a"); L.add ("b"); L.add ("c"); }}  

  public class main {Private Final List & lt; String & gt; L = New Arrestist & lt; String & gt; () {{L.add ("a"); L.add ("b"); L.add ("c"); }}; }  

Former, since this is not an anonymous class;


Comments

Popular posts from this blog

.net - C# List<T>.Find(x=>x.Rectangle.Contains(Point)) FAIL -

iphone - Smoothing a rounded stroke in Core Graphics -

c++ - QtQuick: QQmlApplicationEngine failed to load component qrc:/main.qml:23 Invalid attached object assignment -