Recently, while studying transactions in modern databases, I found out that nowadays transactions don't use a lock or monitor on an entire collection or table, but they usually do it on data of the collection or table that is going to be used by different operations the transactions do.

So I was thinking, let's say we have a data structure, it could be a LinkedList, an Hashtable etc, and multiple different transactions want to access the structure concurrently to update data. How can I ask for lock on the data that is going to be used by the transaction rather then on the entire object data structure? This would obviously improve performances because different update transactions that use different data of the same data structure will happen concurrently.

I will try to clarify more what I would like to achieve, here is an example:

```
public class Table {

    // suppose this is the data of the table and it has a lot of values
    private LinkedList<String> data = new LinkedList();

    public void doTransactionJob() {

        // here we get the data from the list
        // and we ask for monitor on this data so that no other
        // transaction can operate on it
        synchronized(data.get(randomIndex)) {
            // here the transaction works on the data but doesnt
            // block any other transaction from working on the same table
            // but with different data
        }
    }

}

```

Does something similar to my example above exists?