Difference in RowCount Vs EstimatedRowCount Vs FetchedRowCount in ADF

Being an ADF developer,there are few method which is very confusing .So lets discuss method which fetch row count of VO>
Sometimes in ADF applications, we need to count the number of rows, as shown in the table .If we don’t understand these method , it will create a big performance problem.

getRowCount() -> getRowCount() retrives all the records from View Object by executing ViewObject Query.The count is calculated by traversing the Viewobject using next() method until the
last record is retrived. This method hinders the performance of application in case of VO with large number of rows.

getEstimatedRowCount() -> When you need to get quick count of row.Use this method. Method getEstimatedRowCount() actually retrives the count by hitting getQueryHitCount() which runs the select count(*) on the VO query.

getFetchedRowCount() -> Method getFetchedRowCount() counts the number of rows from the Result Set.Returns the number of rows fetched at that point of time.

In Short –

-> When you need to iterate all row to get or check some attribute value use getRowCount().It can create problem issue.
-> When you just need an count of table use getEstimatedRowCount().

If the application, we need to traverse the rowset all records, such as some of the above every line to get attribute values, you can choose to use getRowCount () method;
And if we only need to know the number of rows set the time, then use getEstimatedRowCount () method,

Difference between HashSet and TreeSet in Java | Techartifact

HashSet:

– Class offers constant time performance for the basic operations (add, remove, contains and size).
– It does not guarantee that the order of elements will remain constant over time
– Iteration performance depends on the initial capacity and the load factor of the HashSet.
– It’s quite safe to accept default load factor but you may want to specify an initial capacity that’s about twice the size to which you expect the set to grow.
– The underlying data structure is Hashtable
– Heterogeneous objects are allowed
– Insertion order is not preserved and it is based on hashcode of the objects.
– null insertion is possible.

TreeSet:

– TreeSet class has a member reference variable of type NavigableMap. In fact, TreeSet make use of unique key property of Map’s to ensure no duplicate elements. There is a dummy value used for this instance member variable .
-The underlying data structure is balanced tree.
– Guarantees log(n) time cost for the basic operations (add, remove and contains)
– Heterogeneous objects are not allowed by defalut.
– Insertion order is not preserved and all the objects are inserted according to some sorting order.
– As the first element only null insertion is possible and in all other cases we will get NullPointerException (After null insertion other insertion not possible)
– Guarantees that elements of set will be sorted (ascending, natural, or the one specified by you via it’s constructor)
– Doesn’t offer any tuning parameters for iteration performance
– Offers a few handy methods to deal with the ordered set like first(), last(), headSet(), and tailSet() etc
– we can construct a constructor your own rules for what the order should be using a comparable or comparator.

The TreeSet implementations useful when you need to extract elements from a collection in a sorted manner. It is generally faster to add elements to the HasSet then convert the collection to a TreeeSet for sorted traversal.

To optimize HashSet space usage , you can tune initial capacity and load factor. TreeSet has no tuning options, as the tree is always balanced, ensuring log(n0 performance for insertions, deletions and queries.