Java tutorial
//package com.java2s; //License from project: LGPL import java.util.Arrays; import java.util.List; public class Main { private static final List<String> CODE_EXTENSIONS = Arrays .asList(("xml,php,php3,php4,php5,css,js,c,class,cpp,cs,dtd,fla,h," + "java,lua,m,pl,py,sh,sln,swift,vcxproj,xcodeproj,as,as3proj,asc,bbprojectd,cp,csproj," + "dcproj,dex,dpr,dproj,erb,exp,fs,fsproj,fsx,ftl,gem,gfar,gmk,groupproj,gs,hpp,ise,jspf," + "m,markdown,md,mm,mshc,nib,ocx,pas,pas,pbj,pbxproj,pbxuser,pch,playground,pod,pro,proto," + "psm1,r,rb,rbw,res,resx,sdef,src,trx,v,vbproj,vcproj,vdproj,vtm,wixproj,xq,xsd,yml,4db," + "4th,a,a2w,abc,acd,addin,ads,agi,alb,am4,am5,am6,am7,ane,apa,appx,appxupload,aps,ap_," + "arsc,artproj,as2proj,asi,asm,asm,asvf,au3,autoplay,awk,b,bas,bb,bbc,bbproject,bcp," + "bdsproj,bet,bluej,bpg,bpl,brx,bs2,bsc,c,caf,caproj,capx,cbl,cbp,cc,ccgame,ccn,ccp," + "ccs,cd,cdf,cfc,clips,cls,clw,cob,cod,config,cp,csi,csi,csn,csp,csx,ctl,ctp,ctxt,cu," + "cvsrc,cxp,cxx,d,dba,dba,dbml,dbo,dbpro,dbproj,dcp,dcu,dcuil,dec,def,deviceids,df1," + "dfm,dgml,dgsl,diff,dm1,dmd,dob,dox,dpk,dpkw,dpl,dsgm,dsp,edml,edmx,ent,entitlements," + "eql,erl,ex,exw,f,f90,fbp,fbz7,fgl,for,forth,fpm,framework,frx,fsi,fsproj,fsscript," + "ftn,fxc,fxcproj,fxl,fxml,fxpl,gameproj,gch,ged,gemspec,gitattributes,gitignore,gld," + "gm6,gm81,gmd,gmo,gmx,gorm,greenfoot,groovy,gs3,gsproj,gszip,hal,haml,has,hbs,hh,hpf," + "hs,hxx,i,idb,idl,idt,ilk,iml,inc,inl,ino,ipch,ipr,ipr,ism,ist,iwb,iws,jcp,jic,jpr,jpx," + "jsfl,kdevelop,kdevprj,kpl,l,lbi,lbs,lds,lgo,lhs,licenses,licx,lisp,lit,livecode,lnt," + "lproj,lsproj,ltb,lucidsnippet,lxsproj,m4,magik,mak,mcp,mdzip,mer,mf,mfa,mk,ml,mo,mod," + "mom,mpr,mrt,msha,mshi,msl,msp,mss,mv,mxml,myapp,nbc,ncb,ned,neko,nfm,nk,nls,nqc,nsh," + "nsi,nupkg,nuspec,nvv,nw,nxc,o,oca,octest,odl,omo,owl,p,p3d,patch,pb,pbg,pbk,pbxbtree," + "pcp,pde,pdm,ph,pika,pjx,pkgdef,pkgundef,pl,pl1,plc,ple,pli,pm,po,pot,ppc,prg,prg,pri," + "pri,psc,ptl,pwn,pxd,pyd,pyw,pyx,qpr,r,r,rav,rbc,rbp,rc,rc2,rdlc,refresh,res,resjson," + "resources,resw,rise,rnc,rodl,rpy,rsrc,rss,rul,s,s19,sas,sb,sb2,sbproj,sc,scc,scriptsuite," + "scriptterminology,slogo,sltng,sma,smali,snippet,so,spec,sqlproj,src,rpm,ss,ssc,ssi," + "storyboard,sud,suo,sup,svn-base,swc,swd,sym,t,targets,tcl,tds,testrunconfig,testsettings," + "textfactory,tk,tld,tlh,tli,tmlanguage,tmproj,tns,tpu,tt,tu,tur,twig,ui,uml,v,vbg,vbp," + "vbx,vbz,vc,vcp,vdm,vdp,vgc,vhd,vm,vsmacros,vsmdi,vsmproj,vsp,vsps,vspscc,vspx,vssscc," + "vsz,vtml,vtv,w,w32,wdgt,wdgtproj,wdl,wdp,wdw,wiq,wixlib,wixmsp,wixmst,wixobj,wixout," + "wixpdb,workspace,wpw,wsc,wsp,wxi,wxl,wxs,xaml,xamlx,xap,xcappdata,xcarchive,xcconfig," + "xcdatamodeld,xcsnapshots,xcworkspace,xib,xojo_binary_project,xojo_menu,xojo_project," + "xojo_xml_project,xoml,xpp,xql,xqm,xquery,xt,y,yaml,ymp,ypr,001,abc,acp,act,actx,ada," + "adb,adblock,alm,alp,alx,am,aml,aml,anjuta,applet,appxsym,apr,ascs,asdb,asx,aut,axe," + "basex,bpr,bsh,btn,buildpath,bytes,cap,car,cba,ccs,ccscc,cdxml,ckbx,cma,cpb,cst,ctc," + "cto,ctsym,ctx,dabriefcase,daconfig,ddd,ddm,ddp,ddx,defs,dep,dev,developerprofile,dfk," + "docset,dox,dres,dsk,dsym,dylib,eba,ecp,edm,el,elc,fbp7,fce,fcl,fd,feature,filters," + "fpp,fpt,frj,frm,frx,fsl,gar,gbap,gbas,gbm,gbr,gbs,gdfmakerproject,glade,gls,gml,go," + "gpj,gvy,handlebars,hhh,hrl,hydra,i,ipp,isc,iwz,j,jav,jed,jl,jnilib,jpd,jsh,jss,jsxinc," + "lis,list,lol,lrdb,lsp,m,make,makefile,mako,md,mdown,med,mfcribbon-ms,mlb,mode1v3," + "mode2v3,mvx,nim,orderedtest,os,osc,oxygene,p,p6,pbproj,pc,pde,pdl,perspective,perspectivev3," + "pfg,pkproj,plg,pltsuite,pmq,pom,ppl,ppu,prg,project,psd1,psess,pxi,pym,qml,qx,r,rb," + "rbm,rbw,rbxs,rdoc,reb,rls,rotest,rotestresult,rs,rwsnippet,sb,sbr,sdl,sed,sem,set," + "sex,sgpbpr,sgpsc,sll,slogt,smf,spt,spt,tcc,tiprogram,tmpl,tmproject,umlclass,vala,var," + "vc4,vcx,vdm,vic,vpc,vsct,vsixmanifest,vsl,vspf,wid,winmd,worksheet,wowproj,xbf,xcdatamodel," + "xcode,xojo_binary_menu,xojo_binary_toolbar,xojo_binary_window,xojo_toolbar,xojo_window," + "xojo_xml_menu,xojo_xml_toolbar,xojo_xml_window,xqy,xsx,yab,$01,ab,arr,art,b,bur,cdx," + "cham,chef,ci,cxt,depend,dis,drf,exl,fimpp,global,gm,gnumakefile,gpj,hcf,jsh,kb,kdevdlg," + "kdmp,lit,lrf,markdn,ow,pickle,pnt,prg,pty,rbvcp,rdoc_options,ru,scratch,setup,sjava," + "sml,tpx,vac,x,yml2").split(",")); private static boolean isCode(String ext) { for (String s : CODE_EXTENSIONS) { if (s.equalsIgnoreCase(ext)) return true; } return false; } }