title: What's the best data structure and algorithm for my problem?
body: <p>I'm trying to solve the problem: I have a text file where the columns are separated by &quot;,&quot;. The problem is that I need to be able to search by columns. Example of the data in the file:
  <a href="https://i.stack.imgur.com/EWFpa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EWFpa.png" alt="enter image description here" /></a></p>
  <p>I will parse this file by columns and place all the data in the another data structure(s). So my question is what's the best data structure to use in the case like this (and what's the best algorithm to use for searching in this data structure)? I need to count all the entries that are matching too. For example if I chose last column and typed &quot;4&quot; to search it should show last two strings and count 2 entries. I was thinking on something like list, but the file is pretty big and search would take too long, and I need a solution that won't depend much on the data length. I was thinking about binary search tree too, but not quite sure how to use it here.</p>
  <p>This is kind of learning task so I don't need just a solution (like grep), because I'm trying to implement all of this on Java. I thought maybe this problem has a common solution that some experienced programmers know, or maybe I need to think of by myself. I'm not asking for the solution or the code, just a hint what data structure/algorithm is better to use in the situation like this, some key words.</p>