B4J Question TableView: To 'Object' or To 'List' - that is the question

Discussion in 'B4J Questions' started by Mashiane, Aug 19, 2018.

  1. Mashiane

    Mashiane Expert Licensed User

    Hi there

    I have been using the 'Dim row(3) As Object' notation for a while with tableviews record addition. So I decided to try to use a list instead.

    So I..

    Dim row as List

    of rather row.AddAll(
    array as string("x","y","z"))
    Obviously it works. Question is, whether is it better to use () As Object than a List and whether there is anything significant in using a List or is just a preference issue to use Object/programming style. Yes defining a List needs the additional steps in initializing it and then calling .Add for each or .AddAll (this is doing the same thing anyway)
  2. Enrique Gonzalez R

    Enrique Gonzalez R Well-Known Member Licensed User

    Row(3) and list are the same they inherits from Arraylist. Beyond the extra capabilities of the list There isn't much difference
    Mashiane likes this.
  3. Cableguy

    Cableguy Expert Licensed User

    Also, row (3) has a finite size definition, while a list can be appended to, deleted from.
    Mashiane likes this.
  4. OliverA

    OliverA Expert Licensed User

    My 2 cents. If the list that you add to the TableView has to be generated dynamically, if the list needs to change, or if the list is used for other purposes (other TableViews? Lookup? etc.), then use a list. But if it's just static, the items don't change, and you don't have multiple uses for the "list", then there is nothing wrong with just using the Array As option. For plain one shot static "list" of items, creating a list, initializing, and adding members seems to be a lot of extra typing. In other words, it depends (a common theme in programming).
    Mashiane likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice