ArrayList automatically adding null items

前端 未结 2 1486
梦毁少年i
梦毁少年i 2021-01-18 09:45

Hello everyone. I\'m making a vocabulary App, in which I need to create a List (or ArrayList). To do so, I\'ve created the following piece

2条回答
  •  心在旅途
    2021-01-18 09:46

    You're probably looking at its internal array with the debugger. That doesn't matter; it's just an implementation detail.

    What matters is what's visible through its public API. In other words, what calls to size() (and so on) tell you. (And if that doesn't return 1 in your code example, then something weird is going on!)

提交回复
热议问题