This repository will contain useful matriel and source code for OOP exam.

Overview

PrepForOopExam

Hello everyone!

I assume that you're currently studying for your OOP exam and you are probably tired from exercise 5 , don't know how or from where to get all the needed information.

ME TOO!

So that's why I thought it can be a good idea to create this repo and let EVERYONE share his/her favorite youtube playlist, website or any useful OOP related content.

Feel free to contribute! 💻

Exams

TA

Course Drive

Summary

Campus.il Course website (Hebrew)

Index

  1. Basic Java syntax
    • Data Types
    • Declaring Variables in Java
    • Arrays
    • Java Keywords (static,final etc.)
    • Operators in Java
    • Visibility Modifiers
    • Enum
    • String
    • Packages
    • Modules
  2. Basic Compilation process in Java
    • JVM
  3. Basic OOP terminology
    • information hiding
    • Minimal API
    • encapsulation
    • Abstraction
    • Polymorphism
    • Inheritance
    • Composition
    • Interfaces
    • Abstract class
  4. Basic OOP principles
    • Program to interface not implementation principle
    • The single choice Principle
    • Modularity principle
    • Open-Closed prinicple
    • Leskov substituion principle
  5. Algorithms
  6. Exceptions
  7. Java collections
  8. Design Patterns
  9. Generics
  10. Functional Programming
    • Local and Anonymous Classes
    • Lambdas
    • Functional Interfaces
    • Java.util.functions
    • Closures
    • Callbacks
  11. UML
  12. Advanced topics in Java
    • Serialization
    • Reflection
    • Copy Constructor
    • Clone
    • Frameworks (Spring)
  13. Regex

Basic Java Syntax

Java Keywords

  1. null

    Bike example = null; // no object created here and example points to nothing
    
    example.gear; //  accessing null object attributes leads to runtime errors
    // NullPointerException
    
    Bike example; // By default example value is null
    

Visibility Modifiers

In Java, methods and data members of a class/interface can have one of the

following four access specifiers.

  1. private (accessible within the class where defined)
  2. default or package private (when no access specifier is specified)
  3. protected
  4. public (accessible from any class)

But, the classes and interfaces themselves can have only two access specifiers

when declared outside any other class.

  1. public
  2. default (when no access specifier is specified)

Note : Nested interfaces and classes can have all access specifiers.

  ## [String Class](https://docs.oracle.com/javase/7/docs/api/java/lang/String.html)

The most common java class. Altough it is no a primitive, can be initialized using the '=' sign.

String myString = "hello"; // legal, just like writing new String("hello")

String class has many important useful methods! you can read more HERE about them. String class is immutable meaning we can't change the content of string.

🔼 Back To Top

Basic Compilation process in Java

JVM vs JRE vs JDK

compilation process

🔼 Back To Top

Basic OOP terminology

Object, Class, Instance, Attributes

  • Object is a basic unit of Object-Oriented Programming and represents the real life entities.
  • Class

Abstract class

alt text

Abstract class

🔼 Back To Top

Basic OOP principles

ALL-IN-ONE all the OOP prinicples we've learned and more!

SOLID

  • The Single Responsibility Principle

    A class should never have more than one reason to change.

    every class should have only one responsibility!

    and that responsibility should be entirely encapsulated by the class.

    Responsibility can be defined as a reason to change, so a class or module should have one, and only one, reason to change.

    Why? Maintainability: changes should be necessary only in one module or class.

    How? Apply Curly's Law which means choosing a single, clearly defined goal for any particular bit of code: Do One Thing.

  • The Open-Closed prinicple

    Software entities should be open for extension, but closed for modification i.e. such an entity can allow its behavior to be modified without altering its source code.

    Why? Improve maintainability and stability by minimizing changes to existing code.

    How? Write classes that can be extended (as opposed to classes that can be modified).

    Expose only the moving parts that need to change, hide everything else.

  • The Leskov substituion principle Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.

  • Modularity principle

Program to interface not implementation principle

🔼 Back To Top

Exceptions

🔼 Back To Top

Java collections

alt text

alt text

I'll leave here Javadoc links for every important data structure.

  • Interface Map<K,V> is an object that maps keys to values, no duplicates and each key can map to at most one value.

    • HashMap<K,V> is a Hash table based implementation of the Map interface.
  • List is an ordered collection (also known as a sequence).

    • ArrayList is a Resizable-array implementation of the List interface.
  • Set is a collection that contains no duplicate elements.

    • HashSet implements the Set interface, backed by a hash table (actually a HashMap instance).
  • Time Complexsity table

Design Patterns

ALL-IN-ONE awesome website for diving into design patterns!

Ohad Klein Design patterns Recommended 👑

Factory

Dan Nirel - Factory

Decorator

Derek Banas - Decorator

Iterator

Derek Banas - Iterator

Strategy

Derek Banas - Strategy

Singleton

Derek Banas - Singleton

Observer

Derek Banas - Observer How The Observer Pattern Works

State

Derek Banas - State

Memento

Derek Banas - Memento

Facade

Derek Banas - Facade

Dependecy Injection

DI pattern

🔼 Back To Top

Generics

🔼 Back To Top

Functional Programming

🔼 Back To Top

Algorithms

Source Code by Omri Wolf

MinSumPath

 /***
     * Given a grid of integers of size N x M finds the minimal sum of the path from the upper left corner
     * (0,0) to the bottom right corner (N-1, M-1)
     * @param grid - assuming nut NULL.
     * @return minimal sum of said path
     */
    public static int CalculateMinSumPath(int[][] grid){
        // this solution uses the same grid as the DP array. You can also create a new grid and fill it.
        for (int i = 0; i < grid.length; i++) {
            for (int j = 0; j < grid[0].length; j++) {
                // if i = j = 0 do nothing.
                if (i == 0 && j != 0)
                    grid[i][j] += grid[i][j - 1];
                else if (i != 0 && j == 0)
                    grid[i][j] += grid[i - 1][0];
                else if (i != 0 && j != 0)
                    grid[i][j] += Math.min(grid[i - 1][j], grid[i][j - 1]);
            }
        }
        // return grid[n-1, m-1]
        return grid[grid.length - 1][grid[0].length - 1];
    }
}

LeetCode Reference

Explanation

Unique morse code words

  // all characters' morse code representation, a to z.
    private static final String[] MORSE_CODES = {".-", "-...", "-.-.", "-..",".", "..-.","--.","....","..",".---",
            "-.-", ".-..","--","-.","---",".--.","--.-",".-.","...","-","..-","...-",".--","-..-","-.--","--.."};
    /**
     * find amount of unique morse code translations can be extracted from a list of words.
     * @param words array of strings
     * @return amount of unique morse codes.
     */
    public static int uniqueMorseRepresentations(String[] words) {
        // initialize hashSet for the morse translations.
        Set<String> uniqueMorse = new HashSet<>();
        for (String word : words) {
            // build string one char at a time.
            StringBuilder morse = new StringBuilder();
            for (int i = 0; i < word.length(); i++) {
                // translate character to morse using the MORSE_CODE array.
                char c = word.charAt(i);
                morse.append(MORSE_CODES[c - 'a']);
            }
            // add the translation to hashSet.
            uniqueMorse.add(morse.toString());
        }
        // size of set is number of unique morse codes.
        return uniqueMorse.size();
    }

LeetCode Reference

Explanation

Find duplicate

   /**
     * method finds a duplicate number in an array of N+1 ints, where numbers are in range 1->N.
     * It is important that all numbers are positive.
     * @param numList a list of N+1 numbers in range 1->N.
     * @return the duplicate number.
     */
    public static int findDuplicate(int[] numList) {
        // create 2 pointers on the array
        int i = numList[0];
        int j = numList[0];
        // iterate over the array as a "hashcode", each value is the hashcode for the next index.
        // i jumps 1 time, j jumps twice. stop when they meet (a cycle has been closed).
        do {
            i = numList[i];
            j = numList[numList[j]];
        } while (i != j);
        // find the originator of the cycle. use two pointers, one of the start and one of the end of the cycle.
        // each time jump 1 index, and stop when we get to the duplicate.
        int numCandidate1 = numList[0];
        int numCandidate2 = i;
        while (numCandidate1 != numCandidate2) {
            numCandidate1 = numList[numCandidate1];
            numCandidate2 = numList[numCandidate2];
        }
        return numCandidate2;
    }

LeetCode Reference

Explanation

🔼 Back To Top

UML

🔼 Back To Top

Advanced topics in Java

🔼 Back To Top

Regex

RegexOne - A number of short and precise regex problems. General and not specifc to java.

Regex101 - A regex playground that supports java with problems to solve using regex.

🔼 Back To Top

Comments
  •  Showing All Errors Only Undefined symbol: (extension in Accelerate):__C.vImage_Buffer.free() -> ()

    Showing All Errors Only Undefined symbol: (extension in Accelerate):__C.vImage_Buffer.free() -> ()

    Hi, I am using this plugin for react native app which is used for editing image in both android and ios. It is working fine for android but for ios it is giving this error Showing All Errors Only Undefined symbol: (extension in Accelerate):__C.vImage_Buffer.free() -> () $defer #1 () -> () in (extension in react_native_photo_editor):__C.UIImage.resize_vI(__C.CGSize) -> __C.UIImage? in libreact-native-photo-editor.a(UIImage+ZLImageEditor.o) ld: symbol(s) not found for architecture x86_64

    I have done the setup mentioned in the doc.

    opened by grvsingh789 4
  • Hide Button

    Hide Button

    This is a great library. 👍 But i need hide some button(ex: sticker,... ) non-use. How i can do that?

    Thank for reply! 😄

    opened by hapo-vupq 2
  • Issue compiling on xcode 12.4

    Issue compiling on xcode 12.4

    I seems that the ZLImage editor lib causes a swift compile error here: https://github.com/baronha/react-native-photo-editor/blob/master/ios/ZLImageEditor/Sources/General/ZLEditImageViewController.swift#L289

    I am seeing the error "Type of expression is ambiguous without more context"

    opened by jonotrybe 2
  • Feature request: Expo Config Plugin

    Feature request: Expo Config Plugin

    It would be awesome if this library could ship an expo-config-plugin for EXPO SDK.

    opened by Hirbod 2
  • Problem facing in installation

    Problem facing in installation

    I'm getting this error while I run the command pod install in iOS folder

    [!] CocoaPods could not find compatible versions for pod "react-native-photo-editor": In Podfile: react-native-photo-editor (from ../node_modules/@baronha/react-native-photo-editor)

    Specs satisfying the react-native-photo-editor (from../node_modules/@baronha/react-native-photo-editor) dependency were found, but they required a higher minimum deployment target.

    please help me

    react-native version latest platform :ios, '11.0'

    opened by aloksingh0308 1
  • How to use luts

    How to use luts

    Hi there, I'm trying to embed the editor into my app. The editor does work but there are no filters available besides the default "normal". I think I have put the LUTS files under /ios/LUTs as the example does.

    image

    Am I missing something?

    opened by chitosai 1
  • Example project - Unable to resolve @babel/runtime (iOS)

    Example project - Unable to resolve @babel/runtime (iOS)

    Tried to build and run project in example folder, but stucks after run: Unable to resolve module @babel/runtime/helpers/interopRequireDefault

    Снимок экрана 2021-11-28 в 20 08 09

    Even when i cleaned cache or reinstalled node_modules.

    Environment: Platform - iOS XCode - Version 13.1 React Native - 0.64.2 npm - 8.1.4

    opened by vladimirevstratov 1
  • Can you add the crop feature for Android as well?

    Can you add the crop feature for Android as well?

    Hello,

    Thank you for your great work!

    We would like to know whether you can add crop feature for Android as well

    Thanks

    opened by jasonKRR 0
  • Background color change

    Background color change

    on ios: how can I disable white background on any change, I want to have transparent background but on everychange library changes the background to white color,

    Thanks for the support in advance,

    opened by ironbat1 0
  • Auto close app when click to image editor (Android)

    Auto close app when click to image editor (Android)

    with all version - react-native 0.63

    opened by sacyl-linhdo 4
  • Validation issue

    Validation issue

    we are not able to check if the image is edited or not

    opened by Shivang10169 1
  • iOS Library Suggestion

    iOS Library Suggestion

    Hi, Instead of Brightroom ios library you can use the below mentioned library. https://github.com/longitachi/ZLImageEditor This library has a matching modules respective to the Android Native library.

    enhancement 
    opened by sankar2389 17
Owner
Ido Pinto
I'm a second year CS Student from Israel! Love coding and solving problems.
Ido Pinto
MessageEngine by afkvido. Alpha test is the most updated but may contain many bugs

MessageEngine Alpha Alpha Testing This is the most frequently updated, fresh, and potentially most glitchy version of MessageEngine. This version will

gemsvidø 3 Feb 7, 2022
A sideproject to learn more about object-oriented programming, design patterns and Java meanwhile studying an OOP-course.

MyBank Description A console application that simulates a bank with very simple functions. Potential story could be an employee using this application

null 2 Mar 23, 2022
The goal of this topic is learning OOP principles in Java and modifying elements in 2D arrays.

Homework #11 Table of Contents General Info Technologies Used Project Status Contact General Information Homework contains two topics: Generating rand

Mykhailo 1 Feb 2, 2022
A fun mini project in Java. Uses Interface, Inheritance, and other OOP concepts

Sequences---Arithmetic-and-Geometric A fun mini project in Java. Uses Interface, Sorting, Inheritance, and other OOP concepts About this project: This

Urjit Aich 2 Feb 18, 2022
This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru

Spring Data JPA - Spring Data JPA This repository contains source code examples to support my course Spring Data JPA and Hibernate Beginner to Guru Co

John Thompson 8 Aug 24, 2022
This is the primary repository for the source code of the OpenJML project.

OpenJML This is the primary repository for the OpenJML project. The active issues list for OpenJML development is here and the wiki contains informati

OpenJML 111 Dec 22, 2022
This repository contains the source code for a Product Comparison solution

Product Comparison Installation Guide This repository contains the source code for a Product Comparison solution. Please report any issues here. Insta

Mărgărit Marian Cătălin 8 Dec 5, 2022
An Open-Source repository 🌎 that contains all the Data Structures and Algorithms concepts and their implementation, programming questions and Interview questions

An Open-Source repository ?? that contains all the Data Structures and Algorithms concepts and their implementation, programming questions and Interview questions. The main aim of this repository is to help students who are learning Data Structures and Algorithms or preparing for an interview.

Aritra Das 19 Dec 29, 2022
This repository contains the code for the Runescape private server project, and this repo is soley maintained by @Avanae and @ThePolyphia and @Xeveral

Runescape: The private server project. A Runescape private server based on the 2009 era. This repository contains the code for the Runescape private s

ProjectArchitecture 4 Oct 1, 2022
A boilerplate project designed to work as a template for new microservices and help you get in touch with various useful concepts.

Microservice Reference Project This project is inspired by the idea to quickly create a production ready project with all the required infrastructure

Innovation & Tech 4 Dec 17, 2022
CodeGen - a secure, high efficiency, and offline-able software, it provides several useful functions

CodeGen Efficiency ToolBox Introduce Download References Issues and Suggestions Software Preview Introduce CodeGen is a secure, high efficiency, and o

null 454 Jan 4, 2023
This repository consists of the code samples, assignments, and the curriculum for Data Structures & Algorithms in Java.

DSA_JAVA_REPO WELCOME TO THIS DSA REPO 100 DAYS OF CHALLENGE ⚡ Technologies Language ABOUT THE REPO It's contain basic syntex of java if you want to l

Sahitya Roy 6 Jan 21, 2022
This extension identifies hidden, unlinked parameters. It's particularly useful for finding web cache poisoning vulnerabilities.

param-miner This extension identifies hidden, unlinked parameters. It's particularly useful for finding web cache poisoning vulnerabilities. It combin

Intruder 9 Jan 27, 2022
An evil RMI server that can launch an arbitrary command. May be useful for CVE-2021-44228

evil-rmi-server An evil RMI server that can launch an arbitrary command. May be useful for CVE-2021-44228 in a local privesc scenario Build ./gradlew

Adam Bertrand 12 Nov 9, 2022
Nagram is a third-party Telegram client based on Nekogram with not many but useful modifications

?? Nagram is a third-party Telegram client based on Nekogram with not many but useful modifications. Official site: https://nextalone.xyz Teleg

NextAlone 189 Dec 29, 2022
Features useful for Minecraft content developers.

Easy Development A mod to make Minecraft content development easier. Includes features primarily to assist with mod, resource pack, and datapack devel

null 2 Feb 15, 2022
Nekogram is a third-party Telegram client with not many but useful modifications

Nekogram is a third-party Telegram client with not many but useful modifications

Ketal 8 Nov 13, 2022
This is some Discord bot I made to help me learn Java. Not very useful yet.

JennyChan This is some Discord bot I made to help me learn Java. Not very useful yet. What it can do so far: Reply to mention List commands Show bot u

null 0 Sep 1, 2022
A useful Discord Bot for you!

kottbot A useful Discord Bot for you! Installation Download the build. Put it on your local or root server Execute this command to start the Bot: java

Jannis Wollschläger 1 Jan 24, 2022