Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

Refactoring

Intentions/Quick Assist

Refactoring

Intentions/Quick Assist

Refactoring

Intentions/Quick Assist

Refactoring

Most useful hotkeys

Navigate

Goto

Tricks

Hints

Other useful actions

Code generation

Word completion

Content Assist in Eclipse

Proposals

Content Assist in Idea

Code generation

Smart type

Code generation

Code generation (Eclipse)

Templates

Intentions/Quick Assist

Content Assist

Intentions/Quick Assist

IntelliJ Intentions / Eclipse Quick Assist

Intentions/Quick Assist

Plan:

Plugins

Intentions/Quick Assist

Extract

  • Inline

Ctrl-Alt-N (Idea) Alt-Shift-I (Eclipse)

Imports

The Ultimate Hotkey

Declaration

String

Refactoring

Declaration

Boolean

Rename

Move

Alt-Shift-R (Eclipse) Shift-F6 (Idea)

Alt-Shift-V (Eclipse) F6 (Idea)

Concurrency

Other

  • (Idea) Replace code duplicates with method/constant

Settings - Java - Editor - Content Assist - Advanced

Control flow

  • On demand static import
  • single-member static import

Change method signature

  • (Idea) Replace constructor with builder
  • Generify (Eclipse: infer generic type arguments)
  • (Idea) Migrate (swing)
  • (Eclipse) Introduce indirection (creates static method delegating to selected)
  • (Idea) Type migration. Changes type of all data-flow
  • (Idea) make class or method static
  • (Idea) Convert to instance method. Converts static method with instance param into instance method.

Three different proposal types available by different hotkeys.

  • convert to ThreadLocal
  • convert to Atomic

Ctrl-Space

  • expand
  • == <-> equals
  • simplify
  • a && b <-> !(!a || !b)
  • (Eclipse) inverse boolean expression

The end

JUnit

  • Getter, Setter (Idea) Getter & Setter (both)
  • Equals & hashcode (both)
  • Delegate (both) Eclipse's multiselect more usable.
  • ToString (both) Select fields. Eclipse proposes to select inherited fields/methods.

Productivity and Refactoring

In Eclipse and IntelliJ Idea

  • Key Promoter (Idea)
  • MouseFeed (Eclipse)
  • Navigate files Ctrl-Shift-R (Eclipse) Ctrl-Shift-N (Idea)
  • Navigate types Ctrl-Shift-T (Eclipse) Ctrl-N (Idea)
  • Navigate symbol Ctrl-Alt-Shift-N (Idea)
  • Copy string concatenation to clipboard
  • join concatenated string literals
  • StringBuilder append chain -> sequence
  • String concatenation with SB append (+Eclipse)
  • String concatenation with .format (+Eclipse MessageFormat, select part of a string)
  • (Eclipse) pick out selected part of string
  • Sort members
  • Externalize strings

Eclipse allows search available actions from generate menu using Ctrl-Space.

Alt-/ cyclic word completion (both)

Alt-Shift-/ backward (Idea)

Alt-Shift-S (Eclipse)

Alt-Insert (Idea)

Idea: Ctrl-Shift-A

Eclipse: Ctrl-3

  • Quick documentation: F2 (Eclipse) Ctrl-Q (Idea)
  • Parameter info Ctrl-Shift-Space (Eclipse) Ctrl-P (Idea)
  • Override/implement methods Ctrl-O (Idea).

Separate command "Implement" (Idea)

  • Constructor:

Fields or superclass (Eclipse)

Fields and superclass combined (Idea)

Alt-Enter (Idea)

Ctrl-1 (Eclipse)

  • add @Override
  • declare runtime exception
  • assign param to a field (or create field) (+Eclipse. better matching)
  • convert interface to class
  • array param <-> vararg
  • local var from instanceof if (+Eclipse)
  • cast on instanceof
  • implement abstract class or interface
  • (Eclipse) rename in file/workspace
  • (Eclipse) Extract to local variable (expression)
  • (Eclipse) Extract to constant
  • (Eclipse) Extract method
  • (Eclipse) Inline local variable
  • (Eclipse) Convert local variable to field
  • (Eclipse) Convert anonymous to nested class
  • (Eclipse) Replace with getter and setter (Encapsulate Field)

Automatic generation of the variable name for type. Works in both Eclipse and Idea.

Enter inserts selected proposal

Ctrl-Enter (Eclipse) Tab (Idea) replaces word to the right with selected proposal

Ctrl-Shift-Enter (Idea) Complete current statement

  • Delete line Ctrl-D (Eclipse) Ctrl-Y (Idea)
  • Comment line Ctrl-7 (Eclipse) Ctrl-/ (Idea)
  • Smart select Alt-Shift-Up Alt-Shift-Down (Eclipse) Ctrl-W Ctrl-Shift-W (Idea)
  • Goto to test/test subject Search-"Referring tests" (Eclipse) Ctrl-Shift-T (Idea)
  • Indent Ctrl-I (Eclipse) Ctrl-Alt-I (Idea)
  • Format code Ctrl-Shift-F (Eclipse) Ctrl-Alt-L (Idea)
  • Organize imports Ctrl-Shift-O (Eclipse) Ctrl-Alt-O (Idea)
  • (Idea) Remove middleman (replaces delegation with direct access, breaks encapsulation)
  • (Idea) Wrap method return value (either new or existent class)
  • Convert Anonymous to inner (nested in Eclipse)
  • Encapsulate fields (Idea: batch, Eclipse:one-by-one)
  • Replace temp with query (replaces variable with initializer method)
  • Replace constructor with factory method (Eclipse: not working on nested classes)
  • Last edit location Ctrl-Q (Eclipse) Ctrl-Shift-Backspace (Idea)
  • Ctrl-E Open tabs (Eclipse) Recent files (Idea)
  • Go back/forward Alt-Left Alt-Right (Eclipse) Ctrl-Alt-Left Ctrl-Alt-Right (Idea)
  • Goto line Ctrl-L (Eclipse) Ctrl-G (Idea)

(+Analyze stacktrace trick)

  • implement abstract method
  • (Eclipse) declare method in parent class
  • change raw declaration to generic
  • move assignment to field declaration
  • move initialization to constructor
  • (Eclipse) assign to new local variable or field
  • * import with single-class import
  • qualified name -> import
  • c-style array declaration -> java style
  • split declaration and initialization (+Eclipse)
  • In the right part of the assignment statements
  • In variable initializers
  • In return statements
  • In the list of parameters of a method call
  • After the new keyword in an object declaration
  • Casting
  • Double-pressing

Eclipse:

  • sysout
  • foreach
  • for
  • toarray
  • main

Idea:

  • sout
  • iter
  • itar
  • toar
  • psvm

Language injection

  • Variable Ctrl-Alt-V (Idea) Alt-Shift-L (Eclipse)
  • Constant Ctrl-Alt-C (Idea) No key (Eclipse)
  • Field Ctrl-Alt-F (Idea) (Eclipse: convert local var to field)
  • Parameter Ctrl-Alt-P (Idea) No key (Eclipse)
  • Extract Method Ctrl-Alt-M (Idea) Alt-Shift-M (Eclipse)
  • (Idea) Extract Method Object
  • Extract Parameter Object
  • Extract Delegate Class: Fields and methods (Idea) Only fields (Eclipse)
  • Extract Interface
  • Extract Superclass
  • Api tools
  • Java Non-type proposals
  • Java proposals
  • Java proposals (task focused)
  • Java type proposals
  • JAX-WS proposals
  • JAXB proposals
  • JPA proposals
  • SWT Template proposals
  • Template proposals
  • Word proposals
  • @Nullable
  • extract if from while condition
  • invert if condition (+Eclipse)
  • add braces
  • merge sequential ifs <-> or (+Eclipse)
  • merge nested ifs <-> and (+Eclipse)
  • (Eclipse) swap nested ifs
  • Goto declaration F3 (Eclipse) Ctrl-B (Idea)
  • Goto implementation Ctrl-T (Eclipse) Ctrl-Alt-B (Idea)
  • Quick outline Ctrl-O (Eclipse) Ctrl-F12 (Idea)
  • Show Usages Ctrl-Shift-G (Eclipse) Ctrl-Alt-F7 (Idea)
  • Type hierarchy F4 (Eclipse) Ctrl-H (Idea)
  • Call hierarchy Alt-Ctrl-H (both)
  • Quick fix Ctrl-1 (Eclipse) Alt-Enter (Idea)
  • Mark usages (occurrences) in file auto (Eclipse) Ctrl-Shift-F7 (Idea)
  • Class to another package
  • Static members
  • Instance methods (only into fields of current class)
  • (Idea) Extract inner class OR make class inner
  • (Idea) Convert anonymous class to inner
  • (Eclipse) Text move for non-static fields
  • (Eclipse) Convert anonymous class to nested
  • (Eclipse) Move type to new file (separate command)
  • flip setter calls
  • assert <-> if-throw
  • assignment <-> operator (a=a+b <-> a+=b)
  • catch with throws declaration
  • char <-> String
  • Swap method call args
  • extract increment
  • multiply <-> shift
  • (Eclipse) unwrap block
  • Invert boolean (Idea) via assist (Eclipse)
  • Pull members up/ push down
  • Use interface where possible (Eclipse: use supertype where possible, Generalize declared type)
  • (Idea) Replace inheritance with delegation (delegates to inner class)
  • Useful hotkeys
  • Code completion
  • Code generation
  • Intentions/Quick Assist
  • Refactoring
  • Copy (Eclipse): As inner class
  • remove redundant else
  • while <-> do while
  • for -> while (one-way)
  • foreach <-> indexed for
  • foreach <-> iterator (+Eclipse only iterator->foreach)
  • if <-> switch (Eclipse if->switch)
  • iterate
  • (Eclipse) join declaration and initialization
  • Unimplement interface
  • varargs <-> explicit array creation (asList)
  • {} -> new Array (+Eclipse)
  • check regexp
  • choose color
  • use existent implementation (copy abstract implementation)
  • create test for class
  • generate delegate method with default val for param
  • replace <> with types

Pressing Ctrl-Space again cycle through individual groups.

Proposals could be binded separately to hotkeys via settings.

  • add clarifying parentheses (+Eclipse)
  • remove unnecessary parentheses (+Eclipse)
  • compute constant value
  • create switch branches for enum (+Eclipse)
  • detail exception
  • more general expression in throws
  • flip operands (+Eclipse)
  • flip commutative method call (+Eclipse only equals)
  • Add new parameters and remove the existing ones.
  • (Idea) Propagate new parameters and exceptions through the method call hierarchy.
  • Change the method name, return type and visibility scope.
  • Reorder parameters.
  • Change parameter names and types.
  • Add and remove exceptions.

Thanks for attention!

  • assertion from expression
  • assertTrue <-> assertFalse
  • assertEquals <-> assertTrue <-> assertFalse <-> assertNull

Conditions

  • (Idea) Safe delete (Alt-Del)

Basic: Ctrl-Space (visibility scope)

Class name: Ctrl-Alt-Space (types and static)

Smart Type: Ctrl-Shift-Space (magic)

  • Edit fragment
  • inject language
  • uninject language

The most often pressed hotkey.

Works different in Eclipse and Idea

Zaytsev Ivan

Java Developer

Cogniance, Inc

Numbers

  • if <-> ? (+Eclipse)
  • invert ? condition (+Eclipse)
  • (Eclipse) Pull negation up / Push negation down

Search through all commands

  • dex <-> oct <-> hex
Learn more about creating dynamic, engaging presentations with Prezi