The processing serial library appears to have a slightly different syntax.
For example where processing says
println("Available Serial ports:");
arduino would say
Serial.println("Available Serial ports:);
A more significant difference is that the arduino Serial library has only one port so some of the functionality from processing is not available / applicable.
For instance the port = new Serial...
is just Serial.begin(baud rate) in arduino
while the processing
Serial.list() method simply doesn't exist in arduino since there is only one port.
A closer view of the example you mentioned indicates that the Graph processing code is designed to be run on desktop computer running the processing environment while the arduino runs the small section of code at the top of the example. Not sure where you can find the processing IDE but that code will not run within the arduino IDE.