java: List of String Arrays and remove

前端 未结 4 720
我在风中等你
我在风中等你 2021-01-11 19:01

In a test like this:

    @Test
    public void test() {
        List l = new LinkedList();
        l.add(new String [] {\"tes         


        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-11 19:32

    You are creating a new Object reference and passing it to the remove() method . From the data you posted , it looks like you can create a custom class with two properties and override its equals() and hashCode() instead of storing them as String[] OR Keep the reference to the String[] object inserted and use that reference to remove.

提交回复
热议问题