Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
I have a arraylist in a class that I want to make readyonly how can i do that
How to Select top n queries from a table just by using simple SQL query.
Did they mean you can't add and remove object from your ArrayList, or that the values of the objects contained in the List should be unchangeable?
As far as I am aware there is no way to do this with ANSI SQL, only by using some DB specific variation, such as top, limit or rownum.
Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
Actually the question was like this ... 1st they asked me how to make a class readonly .. I said by making all the variables private and providing getters for them ... then they said what if one of the field is an ArrayList ... I said make it final .. they replied ArrayList should be able to change within the class ... but some who access arraylist from outside should only be able to see its contents.
Actually the question was like this ... 1st they asked me how to make a class readonly .. I said by making all the variables private and providing getters for them ... then they said what if one of the field is an ArrayList ... I said make it final .. they replied ArrayList should be able to change within the class ... but some who access arraylist from outside should only be able to see its contents.
Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
There are various database-dependent methods; many can use a TOP or LIMIT clause.-How to Select top n queries from a table just by using simple SQL query.
Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
Originally posted by Hussain Fakhruddin:
I wouldn't have been able to answer that.
well Rick O'Shay in the interview there are sometimes question that don't make sense practically ... but you need to know them and answer them.
An easy but tedious way to do this is to create a "filter" list object -- that contains the internal list. The implementation methods basically forwards all non mutable operations to the interal list object. Don't forget the iterator, you also need to create a "filter" iterator that does the same thing. This iterator is created and returned when an iterator is asked for.
Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
Originally posted by Rick O'Shay:
The count approach is of limited value, although it does answer the question. I would probably have turned that around and asked what fetching only the top 10 records accomplished. Faster? No: it applies the filter after the query is done. Less bandwidth? Hardly: you can set the size of the result set and the default is 100 records. How do you then get the next 10 records after fetching the first? Count won't work in that case.
Originally posted by Julien Grenier:
see the Javadoc for more information
Julien.
Originally posted by Paul Sturrock:
JavaTM 2 Platform Standard Edition 5.0 API Specification
My blood is tested +ve for Java.
Hussain Fakruddin<br /> <br /><b>IBM 486-OOAD with UML</b>
Amateurs built google. Professionals built the titanic. We can't find the guy that built this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
|