SlideShare a Scribd company logo
1 of 1
Download to read offline
public int getPosition(T anObject)
{ int result = null; // result to return
int lastIndex = length - 1;
for(int index=0; index < lastIndex;index++){
if(anObject.equals(list[index]))
{
result = index;
}
}
return result;
} // end getPosition
Solution
public int getPosition(T anObject)
{ int result = null; // result to return
int lastIndex = length - 1;
for(int index=0; index < lastIndex;index++){
if(anObject.equals(list[index]))
{
result = index;
}
}
return result;
} // end getPosition

More Related Content

More from aradhana9856

no reaction note 1-butanol is a primary alcohol.pdf
                     no reaction  note 1-butanol is a primary alcohol.pdf                     no reaction  note 1-butanol is a primary alcohol.pdf
no reaction note 1-butanol is a primary alcohol.pdfaradhana9856
 
What type of variable is number of people in the roomNominal.pdf
What type of variable is number of people in the roomNominal.pdfWhat type of variable is number of people in the roomNominal.pdf
What type of variable is number of people in the roomNominal.pdfaradhana9856
 
What is the oxidation number for oxygen in H2O2; for OF2 Explain..pdf
What is the oxidation number for oxygen in H2O2; for OF2  Explain..pdfWhat is the oxidation number for oxygen in H2O2; for OF2  Explain..pdf
What is the oxidation number for oxygen in H2O2; for OF2 Explain..pdfaradhana9856
 
We all know humans are good at removing the competition and it is di.pdf
We all know humans are good at removing the competition and it is di.pdfWe all know humans are good at removing the competition and it is di.pdf
We all know humans are good at removing the competition and it is di.pdfaradhana9856
 
Theories devised by keynes and Minsky are similar in concept since M.pdf
Theories devised by keynes and Minsky are similar in concept since M.pdfTheories devised by keynes and Minsky are similar in concept since M.pdf
Theories devised by keynes and Minsky are similar in concept since M.pdfaradhana9856
 
They might have consumed cyanide.The pit of Apricot contains cyani.pdf
They might have consumed cyanide.The pit of Apricot contains cyani.pdfThey might have consumed cyanide.The pit of Apricot contains cyani.pdf
They might have consumed cyanide.The pit of Apricot contains cyani.pdfaradhana9856
 
The attacking of the nucleophile formed in the reactionof acetone an.pdf
The attacking of the nucleophile formed in the reactionof acetone an.pdfThe attacking of the nucleophile formed in the reactionof acetone an.pdf
The attacking of the nucleophile formed in the reactionof acetone an.pdfaradhana9856
 
Terry And Hill can develop a method of profit sharing on below facto.pdf
Terry And Hill can develop a method of profit sharing on below facto.pdfTerry And Hill can develop a method of profit sharing on below facto.pdf
Terry And Hill can develop a method of profit sharing on below facto.pdfaradhana9856
 
The algorithm to reverse a linked list by rearranging the required p.pdf
The algorithm to reverse a linked list by rearranging the required p.pdfThe algorithm to reverse a linked list by rearranging the required p.pdf
The algorithm to reverse a linked list by rearranging the required p.pdfaradhana9856
 
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdf
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdfSplicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdf
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdfaradhana9856
 
since both are strong acids we can add up their individual contribut.pdf
since both are strong acids we can add up their individual contribut.pdfsince both are strong acids we can add up their individual contribut.pdf
since both are strong acids we can add up their individual contribut.pdfaradhana9856
 
PresentationThe capability of enormous information - or the new .pdf
PresentationThe capability of enormous information - or the new .pdfPresentationThe capability of enormous information - or the new .pdf
PresentationThe capability of enormous information - or the new .pdfaradhana9856
 
No it could not serve the same function, because its formation is to.pdf
No it could not serve the same function, because its formation is to.pdfNo it could not serve the same function, because its formation is to.pdf
No it could not serve the same function, because its formation is to.pdfaradhana9856
 
majority of the officials still use presentations in their reagular .pdf
majority of the officials still use presentations in their reagular .pdfmajority of the officials still use presentations in their reagular .pdf
majority of the officials still use presentations in their reagular .pdfaradhana9856
 
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdf
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdfLogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdf
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdfaradhana9856
 
If u insertpendrive there wil b a dialog box press cancel and dont d.pdf
If u insertpendrive there wil b a dialog box press cancel and dont d.pdfIf u insertpendrive there wil b a dialog box press cancel and dont d.pdf
If u insertpendrive there wil b a dialog box press cancel and dont d.pdfaradhana9856
 
Hello,Ther is some problem in you codeI made my own programme as.pdf
Hello,Ther is some problem in you codeI made my own programme as.pdfHello,Ther is some problem in you codeI made my own programme as.pdf
Hello,Ther is some problem in you codeI made my own programme as.pdfaradhana9856
 
Hi,Based on the Data We can Use diffrent type of Data Structure..pdf
Hi,Based on the Data We can Use diffrent type of Data Structure..pdfHi,Based on the Data We can Use diffrent type of Data Structure..pdf
Hi,Based on the Data We can Use diffrent type of Data Structure..pdfaradhana9856
 
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdf
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdfHi!All molecules have London Dispersion forces (Choice A) acting o.pdf
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdfaradhana9856
 
Freezing point depression = Tf= freezing point of water - freezing.pdf
Freezing point depression = Tf= freezing point of water - freezing.pdfFreezing point depression = Tf= freezing point of water - freezing.pdf
Freezing point depression = Tf= freezing point of water - freezing.pdfaradhana9856
 

More from aradhana9856 (20)

no reaction note 1-butanol is a primary alcohol.pdf
                     no reaction  note 1-butanol is a primary alcohol.pdf                     no reaction  note 1-butanol is a primary alcohol.pdf
no reaction note 1-butanol is a primary alcohol.pdf
 
What type of variable is number of people in the roomNominal.pdf
What type of variable is number of people in the roomNominal.pdfWhat type of variable is number of people in the roomNominal.pdf
What type of variable is number of people in the roomNominal.pdf
 
What is the oxidation number for oxygen in H2O2; for OF2 Explain..pdf
What is the oxidation number for oxygen in H2O2; for OF2  Explain..pdfWhat is the oxidation number for oxygen in H2O2; for OF2  Explain..pdf
What is the oxidation number for oxygen in H2O2; for OF2 Explain..pdf
 
We all know humans are good at removing the competition and it is di.pdf
We all know humans are good at removing the competition and it is di.pdfWe all know humans are good at removing the competition and it is di.pdf
We all know humans are good at removing the competition and it is di.pdf
 
Theories devised by keynes and Minsky are similar in concept since M.pdf
Theories devised by keynes and Minsky are similar in concept since M.pdfTheories devised by keynes and Minsky are similar in concept since M.pdf
Theories devised by keynes and Minsky are similar in concept since M.pdf
 
They might have consumed cyanide.The pit of Apricot contains cyani.pdf
They might have consumed cyanide.The pit of Apricot contains cyani.pdfThey might have consumed cyanide.The pit of Apricot contains cyani.pdf
They might have consumed cyanide.The pit of Apricot contains cyani.pdf
 
The attacking of the nucleophile formed in the reactionof acetone an.pdf
The attacking of the nucleophile formed in the reactionof acetone an.pdfThe attacking of the nucleophile formed in the reactionof acetone an.pdf
The attacking of the nucleophile formed in the reactionof acetone an.pdf
 
Terry And Hill can develop a method of profit sharing on below facto.pdf
Terry And Hill can develop a method of profit sharing on below facto.pdfTerry And Hill can develop a method of profit sharing on below facto.pdf
Terry And Hill can develop a method of profit sharing on below facto.pdf
 
The algorithm to reverse a linked list by rearranging the required p.pdf
The algorithm to reverse a linked list by rearranging the required p.pdfThe algorithm to reverse a linked list by rearranging the required p.pdf
The algorithm to reverse a linked list by rearranging the required p.pdf
 
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdf
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdfSplicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdf
Splicing mechanismSmall nuclear ribonucleic acid (snRNA) It is al.pdf
 
since both are strong acids we can add up their individual contribut.pdf
since both are strong acids we can add up their individual contribut.pdfsince both are strong acids we can add up their individual contribut.pdf
since both are strong acids we can add up their individual contribut.pdf
 
PresentationThe capability of enormous information - or the new .pdf
PresentationThe capability of enormous information - or the new .pdfPresentationThe capability of enormous information - or the new .pdf
PresentationThe capability of enormous information - or the new .pdf
 
No it could not serve the same function, because its formation is to.pdf
No it could not serve the same function, because its formation is to.pdfNo it could not serve the same function, because its formation is to.pdf
No it could not serve the same function, because its formation is to.pdf
 
majority of the officials still use presentations in their reagular .pdf
majority of the officials still use presentations in their reagular .pdfmajority of the officials still use presentations in their reagular .pdf
majority of the officials still use presentations in their reagular .pdf
 
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdf
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdfLogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdf
LogMeInLogMeIn found in 2003 and base in Boston, Massachusetts, is.pdf
 
If u insertpendrive there wil b a dialog box press cancel and dont d.pdf
If u insertpendrive there wil b a dialog box press cancel and dont d.pdfIf u insertpendrive there wil b a dialog box press cancel and dont d.pdf
If u insertpendrive there wil b a dialog box press cancel and dont d.pdf
 
Hello,Ther is some problem in you codeI made my own programme as.pdf
Hello,Ther is some problem in you codeI made my own programme as.pdfHello,Ther is some problem in you codeI made my own programme as.pdf
Hello,Ther is some problem in you codeI made my own programme as.pdf
 
Hi,Based on the Data We can Use diffrent type of Data Structure..pdf
Hi,Based on the Data We can Use diffrent type of Data Structure..pdfHi,Based on the Data We can Use diffrent type of Data Structure..pdf
Hi,Based on the Data We can Use diffrent type of Data Structure..pdf
 
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdf
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdfHi!All molecules have London Dispersion forces (Choice A) acting o.pdf
Hi!All molecules have London Dispersion forces (Choice A) acting o.pdf
 
Freezing point depression = Tf= freezing point of water - freezing.pdf
Freezing point depression = Tf= freezing point of water - freezing.pdfFreezing point depression = Tf= freezing point of water - freezing.pdf
Freezing point depression = Tf= freezing point of water - freezing.pdf
 

public int getPosition(T anObject) { int result = null; result .pdf

  • 1. public int getPosition(T anObject) { int result = null; // result to return int lastIndex = length - 1; for(int index=0; index < lastIndex;index++){ if(anObject.equals(list[index])) { result = index; } } return result; } // end getPosition Solution public int getPosition(T anObject) { int result = null; // result to return int lastIndex = length - 1; for(int index=0; index < lastIndex;index++){ if(anObject.equals(list[index])) { result = index; } } return result; } // end getPosition