New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Object Oriented Programming

by: Luisa Beer

Object Oriented Programming COP 3330

Luisa Beer
University of Central Florida
GPA 3.78


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in Computer Programming

This 15 page Class Notes was uploaded by Luisa Beer on Thursday October 22, 2015. The Class Notes belongs to COP 3330 at University of Central Florida taught by Staff in Fall. Since its upload, it has received 41 views. For similar materials see /class/227471/cop-3330-university-of-central-florida in Computer Programming at University of Central Florida.

Similar to COP 3330 at University of Central Florida

Popular in Computer Programming


Reviews for Object Oriented Programming


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/22/15
Arrays and Collections COP3330 Fall 2006 University of Central Florida H Schwartz Outline Arrays Iterator for loop 0 Searching and Sorting Collections ArrayList and Vector CompareTo Co 3330 Fall 2006 A rra ys A single object made up of elements 0 Definition 7 ltElementTypegt ltnamegt Co 3330 Fall 2006 Arrays To construct an array object new lttypegtltsizegt int numbers new mug ew array of integers stringl sentences new St sy of zefzences to strings the strings themselves have not b 1creates a n rin creates an srr rested yet Co 3330 Fall 2006 Arrays Accessing an element numberszfif numbersIl 3 constucting an array to go into the first element sentences 0 new String This is a sentence 39 if numberslm 1 if the first number is 0 do something Co 3330 Fall 2006 Arrays Explicit Initiation and Constants ltElementTypegt name ltexplgt ltexp2gt ltexp3gt m int sequence 1 7 19 259 55539explicit definition i tant final int binarySequence 2 4 8 15 32 54 128 255 Co 3330 Fall 2006 Arrays 0 Methods with arrays new File 3creates an array of files File files files directories create File objects for given files 0 new File something txt files1 new File homeuser files 2 new File homeuseroop txt perform File instance methods on objects if files 0 exists 0 Systemoutprinln it exists String fNames files 1 list lists contents on directory files 2 setLastModified123154623 Co 3330 Fall 2006 Iterator for loop for ltIteratorgt Array ltActiongt computes how many integers are greater than 50 in intAr int numGreater 0 for int i 0 i lt intArlength i if intAri 5 numGreater eguivalent for int num intAr 39f num gt 50 numGreater Co 3330 Fall 2006 Iterator for loop 0 Advantages over traditional for 7 Stays in range 7 Clear code Disadvantages 7 Do not know index 7 New to Java 7 Not as flexible Co 3330 Fall 2006 Searching and Sorting sequentialSearch 7 order will not help array is unsorted 7 or you d like to check every element anyway binarySearch e exploit a sorted list to nd answer faster 7 checks midpoint Co 3330 Fall 2006 Sean ng and SorUng SelectionSort 7 select the smallest or greatest element until every spot is full for int i 0 i lt intArraylength i selecting for intArray 1 int indexOfLeast i for int check i1 check lt intArraylength check check the remaining indices if intArraycheck lt intArrayindexOfLeast indexOfLeast check swap elements in indexOfLeast and 1 positions int temp intArrayi intArra i intArrayindexOfLeast intArrayindexOfLeast tem Co 3330 Fall 2006 CoHchons Framework for many classes that contain a collection of something and perform more advanced arraylike operations 7 ArrayList 7 Vector 7 TreeSet 7 Priority Queue Co 3330 Fall 2006 ArrayList resizable list Co 3330 Fall 2006 ArrayList ArrayList C new ArrayListIS i quot Type of elements in the collection public class Use sAriArrayLisH Wynn rlvate Arra L15tltInte ergt 1ntL15t P y g wawmwm public UsesAnArrayList cm constructor intList new ArrayListltIntegergt Co 3330 Fall 2006 ArrayList Methods void addint i V boolean addT V T getint i T remOVeint i T V boolean isEmpty T setint i int size 4260fb00k Co 3330 Fall 2006 CompareTo 0 public int compareToT V Used to compare elements of a Collection Must implements ComparableltTgt Common classes which implement Comparable 0 String 0 All Number classes Doublemetc Integer Co 3330 Fall 2006 CompareTo 0 Collections algorithms which use compareTo static void sortListltTgt a max min reverse shuffle Co 3330 Fall 2006 Useful Classes COP3330 Fall 2006 University of Central Florida H Schwartz Outline 0 Generic Classes TreeSet PriorityQueue Enumerations Co 3330 Fall 2006 Generic Classes 0 Classes with type parameters 7 Generic in the sense that we do not know what type we will be working with 0 Also called generic polymorphism Allows a method to do different things does not involve inheritance in this case Co 3330 Fall 2006 Generic Classes 0 Example from book class wrapperltTgt instance variable private 391 tvalue public wrapper39r t tvalue t constructor t and tvalue type are same public 391 get H return tValue accessor method public void setT t tValue t mutator method changes values public string tostring retu n tValuetostring text representation 5m Fahmnildllavn knn Java 5 n my k gn Co 3330 Fall 2006 TreeSet Stores a set of objects 7 Keeps contents sorted in ascending order Takes in a type parameter Performs in good time add remove compare because internal storage is a tree Co 3330 Fall 2006 TreeSet Usage Example string stullamel string stullameZ foo barquot 00 Masterquot Treesetltstringgt classRoster new Treesetltstringgt classRosteraddstullame17 classRosteraddstullame27 00P master decides heshe is not the master classRosterremovestullame2 39 check if foo bar really is in the course if classRostercontainsstu ame1H Co 3330 Fall 2006 PriorityQueue Queue an ordered structure with one item which may be accessedremoved directly 7 FIFO 7 LIFO stack 7 Based on priority comparison Pr i or i t yQueue order based on priority Objects in queue must implement Comparable Co 3330 Fall 2006 PriorityQueue Methods ltEgt is type 7 boolean offerE o 7 boolean addE o 7 E peek 7 E poll 7 boolean remove E o 7 int size Co 3330 Fall 2006 PriorityQueue Example assume we have a class ToDoItem which implements comparable has a string and priority number higher more priority PriorityQueueltToDoItemgt tdList new PriorityQueueltToDoItemgt0 popu1ate with things to do tdListoffernew ToDoItellI Cut my hair 10 39 tdListoffernew ToDoItellI Teach a Course 2 find out next thing to do ToDoItem nextTD tdListp011 while nextTD null systemoutprint1ntdList ca11s tostring to print item waitrorKeyo nex D tdListpoll Co 3330 Fall 2006 Enumerations class EnumltTgt super class of all enums enums are built in as part of syntax Good for storing a list of things which could be a class but wouldn t have methods Comparing with self Co 3330 Fall 2006 Enumerations Example 1ist of topics in on just inside a c public enum 391 1 SS opic IHERITANCE EIICAPSULATIOII OBJECTS CLASSES ABSTRACTIDII when using in me 0d Topic today39l opic TopicElICzPSULATIDII if today39l opic TopicDBJECTS Co 3330 Fall 2006


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Janice Dongeun University of Washington

"I used the money I made selling my notes & study guides to pay for spring break in Olympia, Washington...which was Sweet!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.